Welcome Guest, Not a member yet? Register   Sign In
Creating Queue and Worker in Codeigniter 3
#4

Is there a reason you want to do this with codeigniter?
If i understand you correctly you just need to execute a sql statement (get a batch of data from your database) and insert it into another database.

I would recommend you to look at https://www.php.net/manual/en/function.pcntl-fork.php

You could write a single PHP file and the process flow would be the following:
- connect to DB.A and find out the number of rows to fetch
- calculate the batch size and the number of workers needed.
- use pcntl_fork to fork the script where each fork would execute a single batch (ie fetch 100k rows) then the same would insert it into DB.B

Assuming you do not need reporting and managing of the forks this is simple.

There is also simple ways to build a worker/manager/broker in zeromeq.
With ready to use examples in PHP:  http://zguide.zeromq.org/php:chapter2#Sh...ER-sockets
Reply


Messages In This Thread
RE: Creating Queue and Worker in Codeigniter 3 - by qury - 07-14-2020, 07:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB