V
V
vebry2019-01-14 17:51:32
Java
vebry, 2019-01-14 17:51:32

How to parallelize a process?

I came up with a problem for myself: there is a file with 100+K links, which are periodically updated, you need to send for each request, get a response and process it somehow: parse it. For the fastest solution to such a problem, I googled the thread pool, maybe there is a more beautiful way to solve such a problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Boris Korobkov, 2019-01-14
@BorisKorobkov

there is a file with 100+K links, which are periodically updated

Use a queue. For example, https://ru.wikipedia.org/wiki/RabbitMQ
The most efficient way is in bash (curl/wget, grep, sed, etc.). But it is possible in any other PL, including Java.

D
devalone, 2019-01-14
@devalone

Use asynchronous requests, such as Go, where it is out of the box, or Python with asyncio, or any language that you know

S
santaatnas, 2019-01-14
@santaatnas

There is Spring Batch for these purposes (for bulk processing) and some kind of queue broker, you can RabbitMq. Here is an example of spring batch integration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question