Answer the question
In order to leave comments, you need to log in
What is the best way to parse a large amount of data in php?
Hello!
I don’t know how best to process a large number of urls with parsing. I'm sorting out data from travel agencies. I choose between:
1) A crutch with multithreading in php. What is the best crutch to use?
2) Queue of tasks. For example, Rabbitmq (it seems to be convenient to administer, there is a web panel), can you advise something else?
Thanks in advance for your replies.
Answer the question
In order to leave comments, you need to log in
1) Many people advise Gearman, but it didn't work for me personally.
We have in one project a task for || parsing, as a result, the “head on” option still works: at some point, the script forks as many threads as needed, performs all parsing tasks, dumps data into redis, the main process waits for the end of the forks and takes everything from redis.
2) Rabbitmq is a good thing, but look at your tasks here.
If you need to parse something in realtime (while the user is waiting) - then the queues here, in my opinion, are out of place.
If you need to parse in the background - yes, queues are great. You can rabbit, you can use the same redis (if you don’t need complex logic for distributing requests)
Crutch with multithreading in php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question