I am a bit new to the server side of computers. I am working on a social type game. Currently I have a local development setup using the Apache server on the Mac which is running phpmyadmin and a MySQL database. The app posts data to the server using the non asynchronous function. I am trying to go to the next phase of testing which will involve more users so I need to look at web hosting. The amount of data that is sent between the app and the server is vary limited JSON type which basically consists of parameters that have been read from or posted to the database. Correct me if I am wrong but I think a shared hosting setup will do for now. I'm not sure of the point at which I will need to consider vps but I am sure that is down the road. Will I need to write code to queue the requests to a server in a shared or vps hosted environment? Only one person would be able to change a given row at a time anyways due to the game setup (turn based).
How many users at one a given time would a shared host allow? Is it correct that only one person has access to the database at a given instance in time? What happens if two people execute the pho script at the same time? Would both requests be executed? Thanks in advance for any guidance you can provide.
You only need to write code to handle queue if you want to postpone the execution or if the server can't handle the load.
For exemple , if your shared hosting only allow one simultaneous connection to your database , you maybe want to handle a queue instead of letting the user wait or fail.
It's nearly impossible to say how many a shared hosting can handle. There is a lot of parameters that can affect the performance.
If two people execute a script at the same time there is 2 possibilities : The database can handle multiple simultaneous connections : no problem The database is limited to one connection (can happen on shared hosting) : one request will be the first and the second will fail with an error from your database engine.
A workaround is to use persistent connection to your DBMS and it will allow the first request to execute and the second to hang until the first one is completed. A optimised sql code is also a good workaround. The quickest your queries execute the less you can have concurrent access.
Not that having 10 users using your app is not the same thing that having 10 simultaneous connection.