Server data exchange strategy
I am wondering.... The idea is to have a database of scores on a server (Apache/Unix) from a small client program. The program would send periodically status of the game data, score and minor details that should be upgraded on the server database.
What do you think would be the best strategy to implement especially on the server. The simple idea would be a plain php script invoked via http GET or POST passing data as parameters but I see that at each invocation that script would connect to the database, perform the queries and stop connection. If there are many instances of the client software running around I fear for the performance of the server. Any more sophisticated ideas of what to set at the server side?
Another approach could be connecting the client program directly to the server database and update via SQL but I prefer some sort in intermediate script at the server to filter, validate and eventually distribute processing.
Thanks for any ideas.
Re: Server data exchange strategy
i think using a php script to add the data to the database should be ok. the load on database depending to the many connects depends on how many clients you have at a time and how often the data will be send. but the same problem exists, when the clients would do a direct connect to the database.
i would suggests not to you use get and post for parsing the parameters but using an xml dokument for the parameters you need.
that gives you good oportunity of changing the data in later versions.
using php caching on apache would be a god idea to keep the server fast.
Re: Server data exchange strategy
If you have full access to the server you can also considering "Fortune Server Example". And if you use PHP simply use mysql_pconnect to open a persistent connection.
Re: Server data exchange strategy
Many thanks jörg and Lykurg. I think I will go with php, the mysql persistent connection you menction Lykurg looks like a good compromies for efficiency. Thanks.