每秒一个端口有数千个请求 [英] thousands of request in one port per second

查看:122
本文介绍了每秒一个端口有数千个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候全部,


我认为这是发布此问题的正确小组。


我正在研究客户端服务器模型。在这个模型中,客户端是以数千个发送请求的
发送请求。例如每秒左右

2000到3000请求即将到来。所以服务器正在监听udp

端口。一段时间后,大部分请求都被删除了。怎么可以管理这个问题。
多线程会有帮助吗?但它是UDP

端口我不知道在多线程模型中如何处理这个请求。或者

有什么方法可以解决这个问题吗?


提前谢谢


Prakash

推荐答案

Praki写道:
Praki wrote:

>

i认为这是发表这个问题的正确小组。


i正在研究客户服务器模型。在这个模型中,客户端是以数千个发送请求的
发送请求。例如每秒

约2000至3000请求即将到来。所以服务器正在udp端口监听
。一段时间后,大部分请求都是

掉线。怎么能管理这个问题。是多线程将

帮忙吗?但它是UDP端口我不知道如何处理这个请求在
多线程模型中。或者有什么方法可以解决这个问题吗?
>
i think this is the right group to post this question.

i am working on client server model. in this model the client is
sending request in thousands in number. for example per sec
around 2000 to 3000 request is coming. so the server is listening
in the udp port. after some time the most of the request is
dropped. how can manage this problem. is the multi threading will
help ? but it is UDP port i dont know how handle this request in
multi threading model. or is there any way i can handle this
problem ?



错误的新闻组。我们处理标准C,如C

标准中所述。该语言不包含客户端,服务器,

线程,UDP等。您可能需要一个处理

特定系统的新闻组。

-

[邮件]:Chuck F(cinefalconer at maineline dot net)

[page]:< http://cbfalconer.home。 att.net>

尝试下载部分。

Wrong newsgroup. We handle standard C, as described in the C
standard. The language contains none of clients, servers,
threading, UDP, etc. You probably need a newsgroup that deals with
your particular system.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


2008年10月9日14:32,Praki写道:
On 9 Oct 2008 at 14:32, Praki wrote:

i认为这是发布此问题的正确组。
i think this is the right group to post this question.



这是一个非常合适的群体。请忽略CBF,这是一个众所周知的

巨魔,并且已经老死了。

It''s a perfectly appropriate group. Please ignore CBF, who is a known
troll, and senile to boot.


我正在研究客户端服务器模型。在这个模型中,客户端是以数千个发送请求的
发送请求。例如每秒左右

2000到3000请求即将到来。所以服务器正在监听udp

端口。一段时间后,大部分请求都被删除了。怎么可以管理这个问题。
多线程会有帮助吗?但它是UDP

端口我不知道在多线程模型中如何处理这个请求。或者

有什么方法可以解决这个问题吗?
i am working on client server model. in this model the client is
sending request in thousands in number. for example per sec around
2000 to 3000 request is coming. so the server is listening in the udp
port. after some time the most of the request is dropped. how can
manage this problem. is the multi threading will help ? but it is UDP
port i dont know how handle this request in multi threading model. or
is there any way i can handle this problem ?



如果丢包是一个严重的问题,你不应该使用UDP。


你可以尝试增加接收缓冲区的大小,例如:


int bufsize = 1<< 16;

setsockopt(fd,SOL_SOCKET,SO_RCVBUF,& bufsize,sizeof bufsize);


如果失败,你可以维护自己的缓冲区:你的主线程

只能将数据从套接字缓冲区传输到缓冲区,然后

a工作线程可以处理缓冲区中的项目。但最终,如果

数据的进入速度超过了你处理它的速度,那么任何缓冲区都将最终溢出......

If dropped packets is a serious problem, you shouldn''t be using UDP.

You could try increasing the size of the receiving buffer, e.g.:

int bufsize = 1<<16;
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof bufsize);

If that fails, you could maintain your own buffer: your main thread
could just transfer data from the socket buffer to your buffer, and then
a worker thread could process items from your buffer. But ultimately, if
data is coming in faster than you can process it, then any buffer will
eventually overflow...


Praki< vi *************** @ gmail.comwrites:
Praki <vi***************@gmail.comwrites:

问候全部,


i认为这是发布此问题的合适组。
Greetings All,

i think this is the right group to post this question.



[...]


我很害怕它真的不是。你会打赌来自一个处理你的操作系统的小组专家的更好的信息,如果你的话,最有可能是comp.unix.programmer重新使用Linux或其他一些类似于Unix的系统,或者是comp.os.ms-windows.programmer.win32或者一个

的微软。*组如果你'在MS Windows上。


我很抱歉你遇到了Antoninus Twink,一个有时候很棒的巨魔,他们假装很有帮助。如果他真的有兴趣帮助你

解决你的问题而不是打扰这个新闻组,他可能会告诉你其他更合适的b / b


团体。


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

诺基亚

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

[...]

I''m afraid it really isn''t. You''ll bet better information from a
larger pool of experts in a group that deals with your operating
system, most likely comp.unix.programmer if you''re on Linux or some
other Unix-like system, or comp.os.ms-windows.programmer.win32 or one
of the microsoft.* groups if you''re on MS Windows.

I''m sorry that you''ve run into Antoninus Twink, a troll who sometimes
pretends to be helpful. If he were really interested in helping you
solve your problem rather than disrupting this newsgroup, he probably
would have told you about the existence of other more appropriate
groups.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于每秒一个端口有数千个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆