I am trying to make a small online game that allows 100-200 people to operate(like a chatting tool, but mainly just clicking buttons on the user terminals).
I've got the user terminal UI and it communicates with my database (MySQL on my server, a free server). Currently, I can operate on my UI and my app sends information to my server correctly and saves data to my account on the server.
I wonder whether this app will work if two hundreds people were operating at the same moment? I cannot test it because I don't have this population to help me. Does anyone have experience of this? What happens if I will need my server to do calculations based on all users' data? Do I need to add anything like a queue to deal with information in a sequence according to receive time?
Thanks in advance.
MySQL and other SQL databases have systems to prevent data being corrupted called locks. A lock can affect a single row, or an entire table based on what your app is trying to do.
Let's say your app is a series of on/off switches and each user sees only their own set of switches. Each user should therefore have sole WRITE (INSERT) access to the records which determine whether their switch is on or off. This is good, the users won't get in each others' way.
If, however you are also constantly READING (SELECT) from the entire database you may find that this could delay the WRITE instructions from users.
Also, if you are having multiple entities WRITE to the same records in a table ensure that you understand transactions. The short version is: if you read data, and then make a calculation/decision/action on that data and write new data as a result, you should use a transaction to ensure that the data you read in the first place doesn't change while you're processing the command. This is effectively the queue you are considering creating, so no, don't make your own.