Yii Framework Forum: Multiple Db Connections To Leverage Multicore Use With Some Db Servers - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Multiple Db Connections To Leverage Multicore Use With Some Db Servers Rate Topic: -----

#1 User is offline   pommeverte 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 15-March 11

Posted 20 December 2012 - 06:14 AM

Hi everyone,

I don't know if I'm looking at this at the right angle but here's what I was thinking.
Currently Mysql will use one cpu per connection (I believe PostgreSql as well).
Essentialy this means that my Yii application, regardless of the load/queries will always use the same connection to the database and thus the later will only use one CPU.

I would like to know if it would be possible to have Yii randomly jump between a set number of connections to better leverage CPU power.

I was thinking of creating a duplicate db in my configuration and then extending CActiveRecord to randomly fetch the db to use. But:
1) I'm not sure I would get the expected behavior,
2) maybe there is a cleaner way of doing this?
3) maybe I'm just mad and shouldn't even consider

Thanks for your insight!!
0

#2 User is offline   yiqing95 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 593
  • Joined: 27-December 10
  • Location:china

Posted 20 December 2012 - 08:45 AM

see this dbreadwritesplitting

or this topic
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users