A
A
argenit2015-11-06 19:04:25
PHP
argenit, 2015-11-06 19:04:25

What is better to choose for a multi-threaded program on a dedicated server?

Tell me who knows.
You need a program that you run and it works around the clock until you stop it with an external command.
The program should have about 30 threads , and in each thread every second you need to send 1 request to the http server using SSL and process the results.
There is a dedicated server on Linux.
What language or technology would you recommend? I thought about Python or C ++ Half a lifetime of experience on Delphi .... But the server is on Linux. PHP The script has a limitation on the execution time ..
Well, in general, whoever can)))

Answer the question

In order to leave comments, you need to log in

7 answer(s)
B
beduin01, 2015-11-06
@beduin01

Vibed.org is ideal for you.
Here is a book ddili.org/ders/d.en/index.html
examples are in the repository of vibed itself

O
Oleg Tsilyurik, 2015-11-06
@Olej


The program should have about 30 threads and in each thread every second you need to send 1 request to
...
What language or technology would you recommend? Thinking about Python or C++
Multithreading in Python is a sham, a quasi-parallelism, and is not suitable for performance or SMP use.
In C++, this is possible, but very time consuming.
Use Go - there's highly efficient high-level concurrency + good character processing (your HTTP, SSL).

A
Alexander Kubintsev, 2015-11-06
@akubintsev

I'm not sure if you really need 30(!) threads. If you need to process 30 http connections at the same time, then with a probability of 90% you will be satisfied with one process running in the asynchronous model. PHP is enough for this. Look towards reactphp or amphp.
For the remaining 10% of cases, and maybe even less, you will need to actually multithread in order to somehow decompose the load on the processor cores. But this is only necessary if each connection, after receiving data, performs some very resource-intensive operation that blocks everything that is possible, that is, the asynchronous model is already becoming useless. In this case, you can also write in php, for example, using icicleio / concurrent, but it would probably be easier on Go in terms of setting up the runtime environment.

S
sim3x, 2015-11-06
@sim3x

scrapy.org

V
Vitaliy Orlov, 2015-11-07
@orlov0562

As already written above, use the Japanese that you know best. If you have worked with delphi for half of your life, you can look towards java. In my opinion, the biggest problem is not how to launch 100500 threads, but how to organize their interaction (what is downloaded, what to download, where it is and how to upload it, what to do in case of errors, etc.)
You don’t even need to fork on php nothing, you write a bash script that launches 30 php-cli instances, where each instance works with a data queue (some kind of rabbitmq) and that's it. The main thing is not to complicate :)

L
lexa4lexa, 2017-09-06
@lexa4lexa

go.
golang
Initially sharpened for multithreading.
It allows you to create at least thousands of parallel queries very economically.
Syntax - very similar to C and Pascal/Delphi

S
Sergey Savostin, 2015-11-06
@savostin

PHP cli has no execution time limit.
Write on what you know best.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question