views:

79

answers:

2

I am using pylot to stress test a web app I created. The test simulates 100 users logging in the app and the test lasts 200 secs. On average, approx. 4800 requests are made to the server and same number of connections to MySql, each of which executes 5 queries so we are talking about 24K queries during the test.

The queries are simple and the tables are with very little data. The thing is that during the test I cannot access the app from the web. I either cannot connect to MySql or the response time is very slow. Bear in mind that the test is taking place at a CentOS VMware Image I have on my PC (512mb of memory allocated).

Below are the results of the test

Requests: 4809 Errors: 1 Avg Response Time: 3.358 Avg Throughput: 23.53 Current Throughput: 420 Bytes Received: 193028

I believe that the connect errors are caused by the low end test environment, but is there a way I can tune MySql to accept more connections?

Thanks.

A: 

Try and get more details of the errors. Either check the results or add logging to the website.

Nat
A: 

Are you using a connection pool?

MySQL's max connections can easily be increased if you genuinely are running out, look out for this block in either my.ini or my.cnf in the MySQL install dir:

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.

max_connections=500

If you use a connection pool you can limit its size to, say, 250 of the 500 which MySQL has available, then you've got 250 "spare" ones which ensure your web access gets a connection. You can be quite creative in giving a login process 100, data-reads 100, data writes 100, etc., but this obviously effects your application design to a significant extent.

Brian
Hi Brian,No I am not using a pool and the max_connections setting in my.cnf is at 768, so I should not have an issue with the connections (I believe)
Thomas
If it's easy enough to set up connection pool I'd give it a go; you *might* hit that connection limit with such a stress test. Either that or just set it to 1500 and see how you get on :-)
Brian