M
M
Maxim Barulin2013-04-16 16:03:59
PHP
Maxim Barulin, 2013-04-16 16:03:59

Socket server php or python?

Good day Habr!

I stand at the point of choice on what to write the socket server, the choice of python and php. The load on the server is planned to be very large, as it will serve to process personal messages.
Needed to ensure interaction between the site and realplexor `th (hence the restriction on languages, since it has api only for them).
I know PHP well, I wrote socket servers on it, but I didn’t do much load testing. I know Python a little bit, but I don't think it's much more difficult than in php. Here I think what to choose? Will the php server be able to process thousands of requests per second and, with prolonged use, not eat up resources from the server, since php was originally designed for a short operating time, which is why memory trouble is possible.

Perhaps someone has experience in a similar situation. I would appreciate any help.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
V
Vampiro, 2013-04-16
@Slavenin999

Choose what you know best. If you are not writing to improve your skills. Then, at your leisure, you can make a variant in python (for self-education) and compare. Maybe the article will be born on Habr! And for production it is better to go where most of the rake has already been probed.

R
rPman, 2013-04-16
@rPman

I didn’t have any problems with sockets, semaphores, or shared memory from php, memory didn’t leak, it was processed quickly ... but then it all depends on what you will do and use.
And then - the choice of language, a purely holivar conversation. Python has a larger selection of ready-made modules before php (and their organization is much more accurate), there are no problems with integers (32bit vs 64bit) and someone likes the language itself more, but memory consumption in python is much higher than in php, and synthetic tests on working with primitives in php show higher speed.
ps And if you have few external calls and a lot of internal calculations, can you immediately look at c ++? :)

M
Mike Grigorieff, 2013-04-16
@Grigorieff

For Python there is a wonderful thing Twisted

F
farafontov, 2013-04-16
@farafontov

see as already suggested nodejs socket.io redis

K
kapitansky, 2013-04-17
@kapitansky

> since php was originally designed for a short time of work, which is why trouble with memory is possible.
Both languages ​​are scripting.
The resource consumption of PHP will be lower than that of Python.
The speed of work is approximately the same.
In Python, it will most likely be easier to implement.
In general, in a good way, such things are not done either in PHP or in Python. If I were you, I would look towards Java - it will be easier on it than on C, and the speed will be about the same, and maybe even higher (due to the “genius” of the JVM).

S
strib, 2013-04-18
@strib

As an alternative.
There is a special platform for such things - Erlang / OTP.
All you need to eat, the language is relatively simple.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question