Solved

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

Posted on 2013-11-05
15
1,132 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +2
15 Comments
 
LVL 8

Expert Comment

by:virtuadept
ID: 39624511
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
ID: 39624516
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
ID: 39624519
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 8

Expert Comment

by:virtuadept
ID: 39624531
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
ID: 39624621
is this a batch file script

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

Expert Comment

by:virtuadept
ID: 39624639
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
ID: 39624719
not sure this is giving accurate results
seems very low numbers
0
 
LVL 6

Expert Comment

by:RaithZ
ID: 39624741
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
ID: 39624758
the web current connections seems very low also
0
 

Author Comment

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

Expert Comment

by:SsbMs
ID: 39624786
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
ID: 39624790
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
ID: 39625510
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
ID: 39626668
does the lync scripts require powershell
cani run this on 2003
0
 
LVL 8

Expert Comment

by:virtuadept
ID: 39630247
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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

628 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