回合制 iPhone 游戏的托管需求

发布于 2024-11-15 08:27:39 字数 586 浏览 1 评论 0 原文

所以我花了一些时间开发一个 iPhone 应用程序 - 这是一个简单的小游戏,类似于“Words with Friends”,因为它:

1)基于回合

2)联系 Web 服务 API 来存储“游戏数据” (回合、用户信息等)。

就我而言,我使用 .NET MVC 和 SQL Server 后端来开发 API。我们这里讨论的不是大量数据——小图像将被来回传输并存储在数据库中。典型的请求会看到数据库中添加或更改了一些记录。

我对什么时候开始过载没有太多概念——当然,我担心的是这个东西会起飞(显然是一厢情愿的想法),然后我的服务器会不堪重负,以至于死掉。话虽这么说,当我的托管需求可能完全微不足道时,我不想在 Windows Azure 或其他东西上花费时间和金钱。

所以,我的普遍问题是——有人对事情何时开始过载有第一手的了解吗?就像...只是对一段时间内的请求数量或某些内容的一般估计,假设每个请求都会访问 .NET 应用程序,然后该应用程序会访问数据库合理的次数。

即使是一些轶事“我的类似 API 每分钟被点击 10,000 次,并且托管在蹩脚的共享托管上”也会很棒,这样我就得到了一些概念。

提前致谢!

So i've been spending some time developing an iPhone app - it's a simple little game and is similar to "Words with friends" in that it:

1) is turn based

2) contacts a web service API to store the "game data" (turns, user info, etc).

In my case, i'm using .NET MVC and a SQL Server backend to develop the API. We're not talking an immense amount of data here - small images will be transferred back and forth and stored in the database though. A typical request would see a few records added or changed in the database.

I mostly don't have much concept of when things would start to get overloaded - my concern, of course, is that this thing takes off (obviously wishful thinking) and then my server gets so overwhelmed that it dies. That being said, I don't want to spend time and money on Windows Azure or something when my hosting needs may be totally trivial.

So, my somewhat general question is this - does anyone have any firsthand knowledge of when things start to get overloaded? Like...just a general estimate of number of requests or something for a time period, assuming each request hits the .NET app which then hits the database a reasonable number of times.

Even some anecdotal "My similar API gets hit 10,000 times a minute and is hosted on crappy shared hosting" would be awesome just so I get some concept.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

开始看清了 2024-11-22 08:27:39

很难对您的问题给出一个好的答案,因为这很大程度上取决于后端对每个请求的具体作用。即使是您所描述的“微不足道”的服务,根据实际的实施情况,性能也很容易有很大差异。

作为基于我们项目的粗略指南,如果您的 API 是单个 HTTP 请求(无 HTTPS),则命中一个简单的控制器,被转换为单个简单的 SQL 语句(“SELECT * FROM foo WHERE bar”),返回较少如果数据超过 100 字节,您可以在具有 512MB RAM 的 32 位、1 Gigahertz 机器上每分钟处理大约 750 个请求。

但如果其中任何一个因素上升,这个数字将减少到 75 或更少。

也就是说:

这是云计算的典型案例。
如果 Azure 对您来说太麻烦/成本太高(独立开发人员的抱怨并不罕见),您有三种主要选择:

1) 放弃 .NET,转而使用 Python 并在 Google App Engine

Python 学习起来很快,GAE 可以完美扩展,无需您关心。最重要的是,有一个巨大的免费套餐,因此除非您的应用程序真正成功,否则您无需支付一分钱。当您正在为 iOS 进行开发时,我假设您一开始就不会热衷于 .NET。

2) 如果您需要 .NET,请选择 AWS

他们也有相当大的免费套餐。要么把所有东西都放在 Mono 堆栈上(第一年完全免费),要么花钱购买 Windows EC2 实例。这比 GAE 需要更多的规划,但只需做一些工作,您就可以让它扩展到您的应用程序所在的任何地方。

如果成本是一个问题,请使用同一个 AWS 集群来托管多个应用程序的 API。

3) 使用OpenFeint 的多人游戏 API

OpenFeint 支持基本的多人游戏。如果您可以使用它实现所需的功能,那么这可能是最好的解决方案。如果不是,请查看 (1) 和 (2)。

It is very hard to give a good answer to your question as it greatly depends on what precisely the backend does for each request. Even "trivial" services as you describe can easily differ greatly in performance depending on the actual implementation.

As a rough guideline based on our projects, if your API is a single HTTP request (no HTTPS), hitting a bare-bones controller, being translated into a single, simple SQL statement ("SELECT * FROM foo WHERE bar") returning less than 100 Bytes of data, you can serve about 750 requests per minute on a 32 Bit, 1 Gigahertz box with 512MB ram.

But this number will be reduced to 75 or less if any of those factors go up.

That said:

This is the poster-child case for cloud computing.
If Azure is too much hassle / cost for you (which is not an uncommon complaint from independent developers) you have three main alternatives:

1) Ditch .NET in favor of Python and host within Google App Engine

Python is quick to learn and GAE scales beautifully without you ever needing to care. Best of all, there is a huge free-tier so unless your app really takes off, you won't pay a cent. As you are developing for iOS, I assume you aren't hell bent on .NET to begin with.

2) If you need .NET, go with AWS

They also have a rather large free-tier. Either throw everything on top of a Mono stack (completely free for the 1st year) or shell out the money for a Windows EC2 instance. This takes more planning than GAE but with a little work you can make it scale to wherever your app goes.

If cost is a concern, use the same AWS cluster to host several of your Apps' APIs.

3) Go with OpenFeint's Multiplayer API

OpenFeint supports basic multiplayer games. If you can implement the needed functionality using it, then this might be the best solution. If not, look into (1) and (2).

桃酥萝莉 2024-11-22 08:27:39

一根绳子有多长?这一切都取决于托管和连接速度。 .Net 完全有能力处理大量请求。最简单的解决方案是监视服务器(或者,如果您不能,则监视您的 Web 服务性能),并在您的应用程序开始出现问题时获得更好的托管。

How long is a piece of string? It all depends with the hosting and connection speeds. .Net is more than capable of handling LARGE amounts of requests. The simplest solution is to monitor the server (or if you cannot, monitor your web services performance) and get better hosting if your app starts to suffer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文