Welcome Guest, Not a member yet? Register   Sign In
mulithreading
#1

[eluser]unosoft[/eluser]
I am wondering if there was a way that we can load the view and then in the background do some other database inserts.

For example:
$this->load->view(’vquick’);
$this->MTag->insertRecords(); --> I would like this insert to happen in a separate thread so that user does not have to wait for the insert to complete.

Kumar

p.s: Sorry...this is not a cross post. I posted this message in the Lounge forum accidentally earlier.
#2

[eluser]esra[/eluser]
I believe that PHP has an optional or third-party module supporting apartment threading. Fairly sure about this but not positive. The problem of course is that the module needs to be installed on any server where your application is installed.
#3

[eluser]champs[/eluser]
PHP multithreading looks very experimental and not-recently-updated... as in two or three years ago.

Take a peek into CI's hooks feature -- it looks like post_system would work for this.
#4

[eluser]Nanodeath[/eluser]
Could also use INSERT DELAYED if you're using MySQL.

Quote:When a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.

Another major benefit of using INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than performing many separate inserts.
#5

[eluser]bd3521[/eluser]
Is there anyway to implement $this->db->insert_delayed in CI? As long the table is MyISAM or Archive it should work by switching from INSERT to INSERT DELAYED




Theme © iAndrew 2016 - Forum software by © MyBB