使用非专用网络托管 PHP/MYSQL 数据库作为 iPhone 游戏后端
我现在正在完成一款 iPhone 游戏的开发,该游戏使用 PHP/MYSQL 数据库中的数据。我目前(预发布)将所有数据托管在非专用网络托管服务上,但我不知道游戏上线后将如何扩展。我有点担心如果这款游戏还算流行的话它会崩溃。
游戏不会提取大量数据。一般用户每分钟会 ping 数据库 3-4 次,只是为了获取少量数据(一些文本字符串)。只要几个人使用它,一切都可以正常工作,但我对 MYSQL 的了解还不够深入,不知道它将如何扩展到潜在的数百个同时连接。
我对将其转移到专用服务器持怀疑态度,因为它们太贵了,而且我不知道游戏是否会一开始就崩溃,或者是否需要专用服务器。
有什么建议吗?如果我在这里所说的任何事情都是愚蠢的,我很抱歉。这不是我的专业领域。
I'm wrapping up development on an iPhone game right now that uses data from a PHP/MYSQL database. I'm currently (pre-release) hosting all the data on a non-dedicated web hosting service, but I have no idea how that will scale once the game goes live. I'm a bit worried it will crumble to it's knees if the game is moderately popular.
The game doesn't pull in a lot of data. The average user will ping the database 3-4 times a minute just to grab a tiny amount of data (a few text strings). Everything works fine with just a couple people using it, but I don't understand MYSQL well enough to know how it will scale to potentially hundreds of simultaneous connections.
I'm skeptical to move it to a dedicated server because they're damn expensive and I have no idea if the game will tank out of the gate or if it even needs a dedicated server.
Any advice? And sorry if anything I've said here is just plain stupid. This isn't my area of expertise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于任何像这样的实际应用程序,我都会远离共享托管。专用服务器价格昂贵,但您可以从虚拟专用服务器获得可靠且相对便宜的服务。我使用 linode.com 的 VPS 来完成我的所有开发工作,基本计划每月费用为 20 美元,如果需要,您可以非常快速地升级您的计划(只需几分钟)。
I would stay away from shared hosting for any real application like this. Dedicated servers are expensive, but you can get reliable and relatively inexpensive service from a virtual private server. I use a VPS from linode.com for all my dev work, the basic plan costs $20 a month and you can upgrade your plan very quickly (matter of minutes) if needed.
首先对其进行负载测试!
您没有说明如何将数据从 MySQL 数据库提取到 iPhone,因此我假设它以某种形式使用 HTTP 请求。这意味着您可以使用负载测试工具,例如 Apache 的基准测试工具
ab
,向服务器端应用程序生成许多并发请求,并查看它是否可以处理负载。如果应用程序只是读取少量数据并且您已经正确地为表建立了索引,那么您可能没问题。但是,正如其他人指出的那样,VPS 可能是您最好的选择。
Load test it first!
You didn't indicate how the data is pulled from the MySQL database to the iPhones, so I am going to assume that it's using HTTP requests in some form. This means you can use a load testing tool, such as Apache's Benchmarking tool
ab
, to generate many concurrent requests to your server-side application and see if it handles the load.If the application is just reading small amounts of data and you have indexed your tables properly you may be fine. But, as others have noted, a VPS is probably your best bet.