A communication module based on gevent

100 views
Skip to first unread message

胡浩

unread,
Oct 19, 2012, 10:21:36 AM10/19/12
to gev...@googlegroups.com
 I used Gevent to develop a network module. It is just like the protocol of HTTP and it will have 2 kind of communication types(request & response) 
 It is very simple to use, and hope to be useful, please make some comments. 

Aleksandar Kordic

unread,
Oct 19, 2012, 11:29:03 AM10/19/12
to gev...@googlegroups.com
Why not using HTTP, what is the reason to invent new protocol ?

You could drop regexp and use protobuf [1] for
parsing/serializing/deserializing protocol container, it it created
for that reason.

[1] https://developers.google.com/protocol-buffers/docs/pythontutorial

胡浩

unread,
Oct 19, 2012, 9:41:43 PM10/19/12
to gevent: coroutine-based Python network library
Thank you for your reply

1. default http protocol is tcp short connection, a lot of http server
and the client does not support keepalive, so the performance is not
good

2. http protocol can not send multiple requests at once, even if you
enable the pipeline is not true parallel sends a request

3. I only use regex parsing a line of protocol header, the parsing of
body do limit, you can use msgpack or protocolbuff

4. My module uses very little code,
It is also very simple to use,It also supports a timeout detection,
send multiple requests at once,Full-duplex support, as long as the
client is connected to the server, the server can send the request
directly to the client, and does not require client listening port

The Reply All, just reply to personal, sorry

I am sorry my English is poor。


On 10月19日, 下午11时29分, Aleksandar Kordic <alexandarkor...@gmail.com>
wrote:

Ian Epperson

unread,
Oct 19, 2012, 10:41:10 PM10/19/12
to gev...@googlegroups.com
There are plenty of other protocols beside HTTP for communications.  My current favorite for system-to-system communications is ZeroMQ.  It is fast, easy to use and works well with Gevent.
See here for a good introduction: http://nichol.as/zeromq-an-introduction

Your English is far better than my Japanese!

Ian Epperson
--
This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humor or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorized (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word absquatulation has been used in its correct context somewhere other than in this warning, it does not have any legal or grammatical use and may be ignored. No animals were harmed in the transmission of this email, although the yorkshire terrier next door is living on borrowed time, let me tell you. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards, so just ignore that Alert Notice from Microsoft: However, by pouring a complete circle of salt around yourself and your computer you can ensure that no harm befalls you and your pets. If you have received this email in error, please add some nutmeg and egg whites and place it in a warm oven for 40 minutes. Whisk briefly and let it stand for 2 hours before icing.

胡浩

unread,
Oct 20, 2012, 1:52:02 AM10/20/12
to gevent: coroutine-based Python network library
The zeroMQ is a very good project, but I think it is too complicated,
too strong, If you have a problem, but do not understand zeroMQ
internal mechanism may be not easy to troubleshoot the reason, I have
also heard that in some cases it has the problem of lost messages. I
think that the request / response of this model is the most useful
mode, other modes of communication can be easily extended.

I need a more lightweight, simple, reliable components, it supports
two-way communication, and there is no need to consider maintaining a
connection.I need a more lightweight, simple, reliable components, it
supports two-way communication, and there is no need to consider
maintaining a connection to disconnect automatically reconnect after
issue to ask for a long time after the closing less than a response to
be able to get a abnormal, do not have to wait on a response to the
request to send the next request.

My module only a total of more than 100 lines of code, thanks to
gevent, its performance is also good. To keep it simple, do not
maintain the connection, I use udp. If you need to transfer large
data, I would like to better web api, but I encountered communication
between the server and the server are small a udp packet enough to
accommodate.

In addition, I am Chinese, and thank you very much for your reply
Reply all
Reply to author
Forward
0 new messages