Is it possible to write an IM server in python? (be able to handle the heavy connections)
i wanna write an IM server in python, but i'm not sure if python can handle the heavy connec开发者_StackOverflow社区tions?
Thanks in advance.
Omegle is written in Python and as of writing is sustaining 7,057 concurrent online users.
It's not so much about the choice of language, but the efficiency of your code and how well it is optimized.
while true:
# nothing
isn't going to be any slower than
while (1) ;
Yes, you could :)
For example: SecondLife has written a library to support non-blocking IO, you can find it at: http://eventlet.net/
The beauty of Python is, you can optimize the code when it's needed. If some part of your code is executed a lot you can simply replace it with a C function to speed up your entire program without much effort.
gevent is a Python network library based on libevent that is capable of handling thousands of connections. Read the introduction here.
精彩评论