How To Multi Thread Gridview

I have a form that accepts an IP address. I take this IP and run it through a function that does some DNS lookups. I have a loop that goes through about 100 of these lookups per IP, then returns an array to my GridView’s dataProvider to display the results.

This process takes about 40-60 seconds to complete and I am trying to find ways to speed up populating the Grid. The only thing I can think of is to use JavaScript and make these calls asynchronously. Is it possible to pre-populate my GridView then use jquery to execute an async call for each grid row, then make the row visible or not based on the async result?

Is it possible to do something like this on a grid, or should I create my own HTML table and do things manually?

Anyone have any other suggestions?

CGridView widget is rendered server-side by PHP, so you cannot re-populate it afterwards in a convinient manner.

In your case you need a complete client-side solution like this for instance:

http://www.datatables.net/

You create a dynamic table using jQuery based on content provided by Ajax request feedback.

I have no problems using CGridView if I can get the server-side code to execute faster. Right now I need to wait for each dns query to finish before moving on to the next. Perl’s Net::DNS::Resolver has a function called bgsend which submits the query and moves on to the next. I could use this instead of PHP or figure out how to do it using PHP, but that is beyond the scope of Yii. I was hoping Yii would have something similar I could use. Would the use of CQueue work?

I’ll have a look at datatables to see if that will be useful to me.

I will probably try this guys method using Python, and if that works, have my controller action call the Python code and return a data structure to use.

Ok, I managed to get what I wanted working… but how would I call a python script from a Yii controller action? Does Yii have something built in, or can I simply use PHP’s exec()?