1

我正在开发一个 android 应用程序(以及后来的 iPhone 等效)文本处理应用程序。像所有消息传递应用程序一样,我的应用程序发送和接收消息。我用 Eclipse 和 ADT 创建了一个基本应用程序。我在下面发布了架构。说到JAVA,我是个新手。

这个应用程序适用于模拟器和我的设备。但我不知道如何使这个应用程序可扩展。我所做的是在消息到达 Web 服务器时建立连接并将信息写入 mongoDB 并关闭 DB 连接。当我需要向手机发送消息时,我建立连接,从 mongodb 获取数据并将其发送到移动应用程序,关闭数据库连接

我的意思是在实际的生产环境中,如果 100 或 10000 台设备向运行服务的服务器发送消息,我不确定如何使用 servlet 处理此请求。我不确定是否为每个帖子建立数据库连接并获取请求。我相信有更好的方法来做到这一点。

我希望设置一个私有云,其余 api 同时处理 1000 个请求。

谁能给我一些想法如何做到这一点。我使用的技术堆栈是正确的还是我遗漏了什么?请告诉我。

感谢您的时间和建议。

4

1 回答 1

0

Your best option is to write a performance test to emulate the scenarios you're talking about (100 - 10 000 devices sending messages) and see what the results are like. You want to think about the things you want to test, for example

  • Response time (e.g. does the response time increase with an increased number of connections)
  • Server load (does the CPU or other hardware start to creak when you make more connections)
  • Throughput (is the amount of data you can transfer compromised when you have more connections)

You should not test all of these in a single test, but figure out which is important to you and write an appropriate test (or series of appropriate tests)

The results you get will be dependent upon the hardware that you use during testing, but you should be able to get an idea of whether your architecture will handle the sorts of load you're expecting, or whether you need to redesign it.

I did a quick google for both "Writing Java Performance Tests" and "Designing REST Performance tests" and there are lots of articles, webinars and training on this sort of thing.

于 2013-09-02T08:29:17.683 回答