views:

162

answers:

3

Hi all, i wanna write an IM server in python, but i'm not sure if python can handle the heavy connections?

Thanks in advance.

+2  A: 

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) ;
Charlie Somerville
Omegle uses Twisted (http://twistedmatrix.com/), a highly scalable Python networking library.
Mike Graham
i used Omegle once and i didn't know it is written in Python but even the server side? Because i think it uses python web framework only(i just guessing). Thanks anyway =]
Kyle
Omegle originally used Twisted but was rewritten to use gevent (gevent.org): http://groups.google.com/group/gevent/msg/d15a840088291f61
Denis Bilenko
@kyle. you are correct. omegle only uses python client side in the browser
aaronasterling
+2  A: 

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.

WoLpH
Thankssssss a lot. This library is so awesome.
Kyle
A: 

gevent is a Python network library based on libevent that is capable of handling thousands of connections. Read the introduction here.

Denis Bilenko