Yii Framework Forum: Is It Possible To Have Two Databases, One For Reading, One For Writing? - Yii Framework Forum

Jump to content

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

Is It Possible To Have Two Databases, One For Reading, One For Writing? In order to improve performance. Rate Topic: -----

#1 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 18 August 2013 - 12:53 AM

Hi,

is there any way to?:

1) Have 2 database components declared for my application, one pointing to a master database, for writing, and one (or many, ideally) read only replicating databases, for reading only data

2) Redirect writings automatically to master and readings to replica?

If it is not possible, it would be a great addition. If it possible, please be kind and point me to the right direction :)

Thanks in advanced.
Ah! on-off, simplement!
0

#2 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 18 August 2013 - 02:03 AM

That should be transparent to your application, that is this should be resolved in your database directly or using some middleware software.
What database are you using?
Don't be a dick.
0

#3 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 18 August 2013 - 12:33 PM

View Postnineinchnick, on 18 August 2013 - 02:03 AM, said:

That should be transparent to your application, that is this should be resolved in your database directly or using some middleware software.
What database are you using?



Yeah, the database part is already solved. But how can You know which database to use for readings and with for writings? That's it, how can activerecord's find know that it must read from replica and how can save know it must write to master?
Ah! on-off, simplement!
0

#4 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 18 August 2013 - 12:34 PM

You=yii, sorry, I'm posting from a phone computer
Ah! on-off, simplement!
0

#5 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 18 August 2013 - 12:42 PM

What you are looking for is split read/write support. There is an extention for that but I can't comment on its quality. There is an alternative called MySQL proxy which will sit between your application and the actual db.
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#6 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 18 August 2013 - 04:41 PM

View PostDa:Sourcerer, on 18 August 2013 - 12:42 PM, said:

What you are looking for is split read/write support. There is an extention for that but I can't comment on its quality. There is an alternative called MySQL proxy which will sit between your application and the actual db.


Thanks a lot. I'll give the extension a try.
Ah! on-off, simplement!
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