Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to figure my needs regarding web service hosting.

After trying Azure I have realized that the default MySql they provide (through a third party) limits the account to 4 connections. You can then upgrade the account to 15, 30 or 40 connections (which is quite expensive). Their 15 connections plan is descirbed as:

"Excellent choice for light test and staging apps that need a reliable MySQL database".

I have 2 questions:

  1. if my application is a web service which needs to preform ~120k Queries a day (Normal/BELL distribution) and each query is ~150ms(duration)/~400ms(fetch), how many connection do I need?
  2. If instead of using cloud computing, I will choose a VPS, how many connections will I be able to handle on a 1GB 2 cores VPS?

Thank you!

share|improve this question

marked as duplicate by SvW, Ladadadada, Bryan, Michael Hampton Jun 28 '13 at 19:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
The peak number of connections will be an important statistic. You really can't calculate that number with any accuracy. You will have to measure it. –  Ladadadada Jun 28 '13 at 12:24

1 Answer 1

if my application is a web service which needs to preform ~120k Queries a day (Normal/BELL distribution) and each query is ~150ms(duration)/~400ms(fetch), how many connection do I need?

We can't tell from this. You've provided a metric based on the duration of queries - but we need to know the duration of the session. Assuming there is no pattern to the requests (which is a big assumption - even international websites will see a diurnal cycle) and, and that the duration of the sessions follows a more-or-less normal distribution, and that the duration of the session is independent of the number of connections (which is never the case), then the number of concurrent connections will follow a poisson distribution. Hence with this model it's possible to calculate the probability of the system running out of connections. With an average of 1.4 requests per second, and a duration of (I don't understand what you mean by duration/fetch) 150 ms, then the mean number of connections will be 0.11 (if the connection pool were unlimited). You can work out the maths for the probability of failure. It's relatively low.

However we don't know what your threshold for an acceptable rate of failures. And as above, there are a number assumptions which are known to be false. The best way to find the answer is to test it.

share|improve this answer
    
Thank you for your help. I understand that the question might be missing some important variables in order to answer it. What do you mean by "duration of session"? which session? If it helps, the query is executed, retruns a result set, then the web service code closes the connection as soon as the results are fetched. –  Udi I Jun 28 '13 at 15:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.