Web服务协议(实时)

时间:2020-12-01 03:54:06

I'm a little bit confused on what approach is best in this situation. So I am in the process of building a web service in Ruby on Rails. The framework is kinda irrelevant but I added that detail anyways. The web service is based upon a real-time model

我对这种情况下哪种方法最好有点困惑。所以我正在使用Ruby on Rails构建Web服务。该框架有点无关紧要,但无论如何我都添加了这个细节。 Web服务基于实时模型

I'm currently leaning on Java to process the real-time data, especially for the notifications. So this is either going to be comet or web socket based web service. (Leaning on comet)

我目前正在利用Java来处理实时数据,特别是对于通知。所以这要么是彗星或基于Web套接字的Web服务。 (靠彗星)

My question is: What kind of protocol should I use to access the Java server?

我的问题是:我应该使用什么样的协议来访问Java服务器?

I've read that http might be too heavy for a notification / real-time setup and some people recommend a pure UDP protocol. Is this correct?

我已经读过http对于通知/实时设置来说可能太重了,有些人推荐使用纯UDP协议。它是否正确?

Let me know if you need me to clarify on anything!

如果您需要我澄清任何事情,请告诉我!

EDIT:

The number of notifications is going to be significant for each user. Since notifications will also be related to tips about their account (Can't really say much more than that). I want to be able to account for 5,000 - 10,000 users all having hundreds of notifications each week. Real-time for notifications "can" have a lag, but I'm trying to get as little as possible. The size of the messages will not be very big. About the same size as a typical notification, so a few lines of text, the user id, etc...

通知的数量对每个用户来说都很重要。由于通知也与他们的帐户提示有关(实际上不能说更多)。我希望能够为每周有数百个通知的5,000到10,000名用户提供账户。实时通知“可以”有滞后,但我试图尽可能少。消息的大小不会很大。与典型通知大小相同,因此有几行文字,用户ID等...

1 个解决方案

#1


0  

Well, for 10k users with 100 messages a week, that works out to about 1.5 messages a second. not network shattering. seeing as you control the servers on both ends, i'm not sure why you are contemplating http or webservices. just open a socket connection between the servers and send the messages as necessary.

好吧,对于每周100条消息的10k用户,每秒大约有1.5条消息。没网络破碎。看到你控制两端的服务器,我不确定你为什么要考虑http或webservices。只需打开服务器之间的套接字连接,并根据需要发送消息。

#1


0  

Well, for 10k users with 100 messages a week, that works out to about 1.5 messages a second. not network shattering. seeing as you control the servers on both ends, i'm not sure why you are contemplating http or webservices. just open a socket connection between the servers and send the messages as necessary.

好吧,对于每周100条消息的10k用户,每秒大约有1.5条消息。没网络破碎。看到你控制两端的服务器,我不确定你为什么要考虑http或webservices。只需打开服务器之间的套接字连接,并根据需要发送消息。