Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1304
  • Last Modified:

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

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
dougdog
Asked:
dougdog
  • 5
  • 5
  • 3
  • +2
2 Solutions
 
virtuadeptCommented:
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
 
RaithZCommented:
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
 
Joseph DalyCommented:
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
virtuadeptCommented:
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
 
dougdogAuthor Commented:
is this a batch file script

select hostname, count(*)
from sys.sysprocesses
group by hostname
0
 
virtuadeptCommented:
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
 
dougdogAuthor Commented:
not sure this is giving accurate results
seems very low numbers
0
 
RaithZCommented:
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
 
dougdogAuthor Commented:
the web current connections seems very low also
0
 
dougdogAuthor Commented:
the max count is 24 we have 100s using this app
0
 
SsbMsCommented:
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
 
virtuadeptCommented:
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
 
RaithZCommented:
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
 
dougdogAuthor Commented:
does the lync scripts require powershell
cani run this on 2003
0
 
virtuadeptCommented:
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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 5
  • 5
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now