可以用python写一个IM服务器吗? (能够处理繁重的连接)
我想用 python 编写一个 IM 服务器,但我不确定 python 是否可以处理繁重的连接?
提前致谢。
i wanna write an IM server in python, but i'm not sure if python can handle the heavy connections?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Omegle 是用 Python 编写的,截至撰写时已支持 7,057 个并发在线用户。
重要的不是语言的选择,而是代码的效率及其优化程度。
不会比
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.
isn't going to be any slower than
是的,你可以:)
例如:SecondLife 编写了一个支持非阻塞 IO 的库,你可以在以下位置找到它: http: //eventlet.net/
Python 的美妙之处在于,您可以在需要时优化代码。如果代码的某些部分执行次数较多,您可以简单地将其替换为 C 函数,从而毫不费力地加快整个程序的速度。
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 是一个基于 libevent 的 Python 网络库,能够处理数千个连接。请阅读此处的简介。
gevent is a Python network library based on libevent that is capable of handling thousands of connections. Read the introduction here.