Measure Number Of Users Connecting A Server?
Jun 18, 2010how would i go about measuring the number of users connecting a server...
i need to make a code for it..
how would i go about measuring the number of users connecting a server...
i need to make a code for it..
I am trying to determine if I have a database connection leak. So I need to see the number of open connections. I have some simple test code that creates a leak:
protected void Page_Load(object sender, EventArgs e)
{
for(int i = 0; i < 100; i++)
{
SqlConnection sql = new SqlConnection(@"Data Source=.SQLExpress;UID=sa;PWD=fjg^%kls;Initial Catalog=ABC");
sql.Open();
}
}
Note there is no .Close and this does infact crash after being run 3 times in quick succession.
In order to measure the leak I am running the Performance monitor and measuring SQLServer: General Statistics/User Connections:
However, these seem to be zero when I run my code:
What should I change to actually see the connections?
ANSWER
I have approved an answer below. Even though it doesn't use the performance tools, its good enough for my use. Bottom line is I wanted to see how many connections remain open after opening a web page and this did the trick.
My environment is ASP.Net + IIS 7.0 + Windows Server 2008 + .Net 3.5. I am wondering whether the number of users online and number of active session are the same thing? The other question is, no matter whether they are the same, how to calculate them (i.e. for a given time, what is the number of users online, and related active number of sessions)?
View 1 RepliesWe have implemented the ASP membership and roles..and we would like to display the users currently logged in and also display the number of users online so we can display that on the page. The list of users woudl only be available to our admins. BUt the number of users will show for everyone.
View 9 RepliesWhile working with LINQ to ENTITIES I see that there is only a way to use stored procedure that is returning one entity only, or a view that is a join of two entities.
But what if I need in ASPX page to get two tables that there is NO connection between them, no join can be done between them at all.
I have one Stored Procedure that return the two tables, but entities don't support this right now.
I can split them to two Stored Procedure and call each of them separately.
Can I connect to a ubuntu server, that is running mysql using ado.net or do I need a special driver?
View 2 RepliesMy Asp.net application uses 25-30% of the CPU on a test server which has 600 MB Ram on it.
I can see the asp_wb process taking that much percentage of CPU.
This is when I am testing using one user.
How many users can the server afford then without falling over?
Is there a relationship between the CPU Usage and number of user aka if there are 2 users my application will sky rocket to 60% of memory usage?
I am working on a website in which more than a thousand users can login at a time and there may be more than 50000 total users. I am worried about the performance of the application in case of concurrent access.
what is the best way to manage that, so that my application runs without any performance issues.
what I need to know is how to show a count of how many users are signed on with a custom sql script, here is what i got that shows total users but not total online
[Code]....
Again this gives a total count but i need a total count of who is online with this setting, and try to keep it in sql statement if possible as i have not yet learned how to use stored procedures.
We have a MOSS 2007 custom web part based on a user control that queries a database cluster. When the connection to the database is made, we regularly experience the error below and have had to create a work-around in the code to retry the connection. We have 3 environments - development, staging and production; the error only occurs in production. The difference in the production environment is it is a farm with 3 WFEs and a SQL cluster, where development and staging are single machine instances. All are MOSS 2007 & SQL Server 2008. We cannot find what is causing this issue and I'm hoping someone else has experienced a similar problem and knows the cause.
This is the error that occurs frequently when the query is executed:
System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.WriteSni()
at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at [Our Namespace.OurMethod](String someParam)
More than one method will generate this, but this is typical code, note the retry work-around:
public static DataTable OurMethod(string someParam) {
const string query = "sp_OurStoredProcedure";
var resultsTable = new DataTable();
var connection = new SqlConnection { ConnectionString = OurDatabaseConnection };
var command = new SqlCommand(query, connection) { CommandType = CommandType.StoredProcedure };
var dataAdapter = new SqlDataAdapter(command);
var retry = 5; SqlConnection.ClearPool(connection);
while (retry > 0) { try { command.Parameters.Clear();
command.Parameters.AddWithValue("@someParam", someParam);
connection.Open(); dataAdapter.Fill(resultsTable); retry = -1;
} catch (Exception ex) { retry--; if (retry <= 0) {
LogError("Exception: DataAccess:OurMethod: *RETRIES EXCEEDED* " + ex, "error");
} else { SqlConnection.ClearPool(connection);
LogError("Exception: DataAccess:OurMethod: ATTEMPTS REMAINING " + retry + ". " + ex, "warning");
} } finally { dataAdapter.Dispose(); command.Dispose(); connection.Dispose();
} } return resultsTable; }
I have got the total number of registered user's and the total number of users online working without any problems after a search on here.
[Code]....
but I would like to expand this a little. Can any one tell me how I would display the total number of users who are approved and the total number who are locked out.
I developed a website in asp.net,c# and SQL server2000. In each and every page I want to show the logged in users name with green color text.
I used Forms authentication.
I have an asp.net 3.5 web application for which the client has requested that the security model allows (a licensing model) restricting the number of simultaneous users logged onto the website. I am not sure how this is achievable - I'm currently controlling membership via the AspNetSqlMembershipProvider.
View 5 RepliesWith performance counter to observe the "Sessions Total", I found the # of session stays the same after users logout. Is this expected behavior in IIS7?
Here is the logout implementation:
Session.Clear();
Session.Abandon();
FormsAuthentication.SignOut();
I would like to know the number of users logged into my ASP.NET 2.0 application.
Points to be considered:
1) Simplest way would be to use Application or Cache object to have the counts on Session start or end. However this would fail if there is a worker process recycle. Wouldn't it?
2) Should't make a difference whether the session is inproc/state server managed/ or SQL server managed.
3) Should preferably be seamless to a web-farm architecture.
I am using ASP.Net + .Net 3.5 + VSTS 2008 + IIS 7.0 + C# to develop a web application. I want to count how many users are online. This is my current implementation,when Session_Start is called, I will increase # of users online by 1;when Session_End is called, I will descrease # of users online by 1.Two quesitons,A Is that implementaiton correct?B. Another question is, I think this method can not track # of users of real time, since when user closes the browser, Session_End will not be called immediately (Session_End will be deferred to be called). Correct?
View 3 Repliesi want to know online user in my web site.
View 1 RepliesI have a website that has 10 aspx pages in it, and I'm trying to count how many users are on any one page at a time, and display that number on the web page. I have set it up to use an Application object ("TotalViewers"), and initialize it to 0 in the Application_Start event handler of the global.asax file. My reasoning (probably way off base) is to increment the count on each page load, and then decrement the count on each page unload. The increment part works ok, but when I add the code in the page unload event handler to decrement, it seems that Unload happens before the Page is presented to the client, so the value always stays the same (adds one in page load, subtracts one in page unload).
How else can I track number of users on each page? (simply, becuase I am still a beginner). I have already done some google searching and haven't come up with anything useful.
All my pages are being navigated via a TreeView control.
I want to know what the members who are online at my site and I can identify them.Do you have an article that identifies registered online users like your site.
View 1 RepliesI have one application and there are 1500 users of that application.When 200 users logged in application that time login page and other pages of applications are not opend. I want to manage 1000 of users at a time.
View 1 RepliesI want to know hom many users that uses may website (they logged in in current time)
or how many active seesions are in my site in asp.net using C# ?
I have developed a web application in asp.net with C# in visual Studio 2005. And i used sql server 2008 as back end. When i run the program, it shows the following error..An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
View 2 Repliesor one of my project, I use Access 2007.I have application written by Access, that use database : Sql-Server 2007.I am using XP for the any company computer.The dsn file is on network, and include connectionString with username + password,ut I want to access the database from any user with automatic authentication (no need for user and password).
View 3 Replieshow do i connect visual web developer to sql server express 2008? in the Database Explorer, i right click on Data Connections, click Add Connection..., and in the Data source box i choose Microsoft SQL Server (sqlClient), which i'm guessing doesn't connect me to a database file, but to sql server express itself(?). in the server name box when i click the drop down box, there's nothing there and that's where i get stuck.
View 3 RepliesI am using this code to connect to my exchange server using POP3.I am trying to retrieve an inbox of basically emails that have not been read however, i am just getting a bunch of gibberish and its reading an email. modify my code to just read the most recent messages.
Try
tcpClient.Connect(hostName, 110)
Dim networkStream As NetworkStream = tcpClient.GetStream()[code]...
when i use top instead of retr i get this
+OK X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: by xch0p.com id <01CB58CE.A6A4EA@p.com>; Mon, 20 Sep 2010 09:17:07 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CB58CE.81A6A4EA" Content-class: urn:content-classes:message Subject: What we need to do?? Date: Mon, 20 Sep 2010 09:17:07 -0500 Message-ID: