Solved

find out how many users are connected to a front end server

Posted on 2013-11-05
15
892 Views
Last Modified: 2013-11-26
is it possible to find out how many users are on each of my 4 front end servers?
i have four front end servers conencted to a sql back end server
the front end servers are on a load balancer.
however i cant tell exactly how many users are on each server
the front end servers provide a web front end for our portal through iis
i need to be able to find out if users are spread evenly over all servers
0
Comment
Question by:dougdog
  • 5
  • 5
  • 3
  • +2
15 Comments
 
LVL 8

Expert Comment

by:virtuadept
Comment Utility
You could look at sysprocesses and group by hostname:

select hostname, count(*) 
from sys.sysprocesses
group by hostname

Open in new window


And that will tell you how many connections to the database you have per machine. That may not equal number of users depending on your your application is coded but it should still probably be roughly what you want.
0
 
LVL 6

Assisted Solution

by:RaithZ
RaithZ earned 250 total points
Comment Utility
You can monitor active connections by using performance counters on each box.  See this link:

https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/86afd5ee-e183-4a5a-91fd-cf795289c34f.mspx?mfr=true
0
 
LVL 35

Expert Comment

by:Joseph Daly
Comment Utility
You can also use windows performance monitor to gather the counters. In performance monitor you can add the counter under web service/current connections.

http://stackoverflow.com/questions/567076/how-to-view-current-users-with-performance-monitor
0
 
LVL 8

Expert Comment

by:virtuadept
Comment Utility
I should add that hostname in sysprocesses is provided by the client in the connection string and can be altered programatically so in some cases that may not actually be the host computer name.
0
 

Author Comment

by:dougdog
Comment Utility
is this a batch file script

select hostname, count(*)
from sys.sysprocesses
group by hostname
0
 
LVL 8

Expert Comment

by:virtuadept
Comment Utility
That is a SQL query for the database server. You could do it in a batch file I guess, if you use OSQL or SQLCMD command line clients for SQL. I am assuming we're talking about Microsoft SQL here. The other performance monitoring tools that others mentioned may work out better for you.
0
 

Author Comment

by:dougdog
Comment Utility
not sure this is giving accurate results
seems very low numbers
0
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 
LVL 6

Expert Comment

by:RaithZ
Comment Utility
The SQL connection counts may not reflect the number of web users since the application may re-use existing connections for queries.  You would be better off checking it at the web servers itself rather than the database.
0
 

Author Comment

by:dougdog
Comment Utility
the web current connections seems very low also
0
 

Author Comment

by:dougdog
Comment Utility
the max count is 24 we have 100s using this app
0
 
LVL 1

Expert Comment

by:SsbMs
Comment Utility
This script pulls Microsoft Lync 2010 connection information, such as the number of connections per Front End Server and number of unique users

http://blogs.technet.com/b/nexthop/archive/2011/03/22/scriptconnections.aspx

Good Luck..
0
 
LVL 8

Accepted Solution

by:
virtuadept earned 250 total points
Comment Utility
If the web app is sharing connections to the database then the SQL query will not tell you how many users you have (that is what I was trying to hint in my first post that depending on how the app is coded, it may not be individual users). However, it should tell you roughly if load balancing is working or not, which was your question I thought. If you're not seeing any db connections from some of the web servers then you know they aren't getting users. If you need to know exact number of active users then you need to use the link provided above by RaithZ to set up connection monitoring on IIS on each of the web servers.
0
 
LVL 6

Expert Comment

by:RaithZ
Comment Utility
Depending on the app also, your users may not be "connected" the entire time the app is being used, but only connect when the app needs to submit to request information.  Many web applications run in the browser and only connect back to the web server every so often.  Again this depends on how the application was coded or is made.
0
 

Author Comment

by:dougdog
Comment Utility
does the lync scripts require powershell
cani run this on 2003
0
 
LVL 8

Expert Comment

by:virtuadept
Comment Utility
I was thinking another approach for this, if you have control and source for the application, or if it already has a feature like this, is to log to a table on the database when users connect to the application, and then depending on how long the average user session is, you could get a pretty good estimate of how many are on using the connection log. And in your log, hostname should be one of the things logged, so you can group by hostname when getting counts. If the users have to perform some kind of log off or have some system enforced auto-log-out timer, that makes this a lot easier so you know for sure if they have not logged out yet that they are still an active. And obviously you need to write to the table when log out happens as well as log ins.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now