13 Replies Latest reply on Jan 16, 2013 6:11 AM by erasmomarciano

    How to count active session in JBoss AS 7

    erasmomarciano

      Hi

       

      How to count active session?

      Can I see the active session with jbosscli or admin console?

       

      thank a lot

        • 1. Re: How to count active session in JBoss AS 7
          nickarls

          Active what sessions? HTTP?

          • 2. Re: How to count active session in JBoss AS 7
            erasmomarciano

            JsessionID

            • 3. Re: How to count active session in JBoss AS 7
              nickarls

              I must say I'm not convinced the "current active session count" statistics is exposed anywhere I'm aware of...

              • 4. Re: How to count active session in JBoss AS 7
                ctomc

                Nicklas Karlsson wrote:

                 

                I must say I'm not convinced the "current active session count" statistics is exposed anywhere I'm aware of...

                 

                Ofcourse it is

                 

                /subsystem=web/connector=http:read-resource

                or any other connector there is.

                 

                and you also have

                /deployment=name-of-your-app.war/:read-resource

                or

                /deployment=name-of-your-app.ear/subdeployment=name-of-web.war:read-resource

                and then you can go even deeper

                 

                /deployment=name-of-your-app.war/servlet=myservlet:read-resource

                 

                 

                --

                tomaz

                • 5. Re: How to count active session in JBoss AS 7
                  ssilvert

                  I don't see it on the http connector, but with AS7.2, you can see the active HttpSessions on a per-deployment basis:

                  /deployment=myapp.war/subsystem=web/:read-attribute(name=active-sessions)
                  {
                      "outcome" => "success",
                      "result" => 1
                  }
                  

                   

                  Stan

                  • 6. Re: How to count active session in JBoss AS 7
                    nickarls

                    Some stats are shown but as Stan pointed out at least on 7.1.1 the active sessions are not among them.

                    But the feature in 7.2 is welcome, it would be good if they could be summed up on connector basis though.

                    I tried the servlet level (you apparently need the subsystem in the command, too) but I get a

                     

                    ]): java.lang.UnsupportedOperationException

                              at org.jboss.dmr.ModelNode.checkProtect(ModelNode.java:1560) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final]

                              at org.jboss.dmr.ModelNode.get(ModelNode.java:795) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final]

                              at org.jboss.as.web.WebDeploymentServletDefinition$AbstractMetricsHandler$1.execute(WebDeploymentServletDefinition.java:95) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                     

                     

                    I haven't verified with a clean AS or checked JIRA if it's known/fixed already.

                    • 7. Re: How to count active session in JBoss AS 7
                      ssilvert

                      I don't think the HttpSession can really be tied to the connector.  You should be able to hit the same app using different connectors.

                       

                      It's easy enough to sum these up though.  Here is the CLI command that displays active-session for all deployments:

                      /deployment=*/subsystem=web/:read-attribute(name=active-sessions)
                      {
                          "outcome" => "success",
                          "result" => [
                              {
                                  "address" => [
                                      ("deployment" => "AS7-6262.war"),
                                      ("subsystem" => "web")
                                  ],
                                  "outcome" => "success",
                                  "result" => 1
                              },
                              {
                                  "address" => [
                                      ("deployment" => "metamer-jbas71.war"),
                                      ("subsystem" => "web")
                                  ],
                                  "outcome" => "success",
                                  "result" => 1
                              }
                          ]
                      }
                      

                       

                      If you want to see all these new 7.2 stats in a web app, take a look at my "Do it yourself console" demo:

                      https://github.com/ssilvert/diycdemo

                       

                      It lets you call CLI commands from a JSF Facelets page.

                       

                      I added something new to the demo to show how easy it is to sum these things up.  I just used <c:forEach> and <c:set> to get the Total HTTP Sessions.

                      TotalSessions.png

                      Stan

                      1 of 1 people found this helpful
                      • 8. Re: How to count active session in JBoss AS 7
                        nickarls

                        Perhaps the current active requests would be a better measurement for current http connector load indication?

                        • 9. Re: How to count active session in JBoss AS 7
                          ssilvert

                          Nicklas Karlsson wrote:

                           

                          Perhaps the current active requests would be a better measurement for current http connector load indication?

                          Probably.  I don't see any way to get that though.

                           

                          Of course, it depends on what you are trying to measure.

                           

                          Stan

                          • 10. Re: How to count active session in JBoss AS 7
                            erasmomarciano

                            I'm using  7.1.1

                             

                            I tried so:

                             

                            [standalone@localhost:9999 /] /deployment=*/subsystem=web/:read-attribute(name=active-sessions)

                            {

                                "outcome" => "failed",

                                "result" => [

                                    {

                                        "address" => [

                                            ("deployment" => "javamelody-1.41.0.war"),

                                            ("subsystem" => "web")

                                        ],

                                        "outcome" => undefined

                                    },

                                    {

                                        "address" => [

                                            ("deployment" => "miocorso.war"),

                                            ("subsystem" => "web")

                                        ],

                                        "outcome" => undefined

                                    },

                                    {

                                        "address" => [

                                            ("deployment" => "demo_database.war"),

                                            ("subsystem" => "web")

                                        ],

                                        "outcome" => "failed",

                                        "failure-description" => "JBAS014792: Unknown attribute active-sessions",

                                        "rolled-back" => true

                                    }

                                ],

                                "rolled-back" => true

                            }

                             

                             

                            doesn't work "failure-description" => "JBAS014792: Unknown attribute active-sessions",

                             

                            Why I get this error?

                             

                            tnks

                            • 11. Re: How to count active session in JBoss AS 7
                              nickarls

                              It's only for 7.2

                              1 of 1 people found this helpful
                              • 12. Re: How to count active session in JBoss AS 7
                                ctomc

                                most of it is also already in 7.1.2

                                • 13. Re: How to count active session in JBoss AS 7
                                  erasmomarciano

                                  Thank