0

I want to have more than one connection to my database. i am using persistent => false and 5 ajax calls has been made which fetch data, and now each query is waiting for prvs to complete. I want all these 5 queries run in parallel

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'user' => 'cluster',
    'password' => '',
    'database' => 'cluster',
    'prefix' => '',
);

EDIT:- I got my problem, the problem is blocking connections are being made, how to make non blocking request for my requests..?

Daljeet Singh
  • 704
  • 3
  • 7
  • 17

2 Answers2

1

I think you want to excute a set of query simultaneously, I think you need to connect databse dynamically, Just see the bellow link, may be help you

https://stackoverflow.com/a/13224580/2460470

Community
  • 1
  • 1
Supravat Mondal
  • 2,574
  • 2
  • 22
  • 33
0

Just copy and paste your connection and name it different and use that name in your models useDbConfig property, that's all.

But what you say doesn't make much sense. Each of the 5 AJAX calls creates a complete new request and runs through the whole php stack before it even reaches the DB. The way you want to "optimize" this just doesn't make sense.

floriank
  • 25,546
  • 9
  • 42
  • 66
  • I don't want to create multiple connection variables in my config... It is sending blocking request... I want to use non blocking requests for the queries... – Daljeet Singh Jan 22 '15 at 11:27
  • I still don't get your problem then. Add a better description of the *real* problem to the question. I don't see how the DB is related to the requests, blocking or not. – floriank Jan 22 '15 at 11:41
  • I've seen you asked a very similar question before that was at least better to understand but closed as a duplicate of http://stackoverflow.com/questions/70855/how-can-one-use-multi-threading-in-php-applications – floriank Jan 22 '15 at 11:47
  • Hi burzum, this would not resolve, i have gone through this doc... also everything going fine, my problem is blocking requests are being made for all queries. in netplant other connection has status of Waiting status... – Daljeet Singh Jan 22 '15 at 11:50