Yii Framework Forum: Lazy Db Connection - Yii Framework Forum

Jump to content

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

Lazy Db Connection Rate Topic: ***** 1 Votes

#1 User is offline   piotrch 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-March 13

Posted 06 March 2013 - 04:17 AM

Hi! I develop website about high traffic. At last hosting was down becouse has to many connections to database (mysql). Most of all requests fetch data from memcached and connecting to db is not necessery. Is any way to connect to database "on demand" but not always request?
0

#2 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 774
  • Joined: 02-July 10
  • Location:Central Poland

Posted 06 March 2013 - 08:10 AM

It is lazy loaded by default. all application components work this way - thay are instantiated only on first access. You can make them loaded by default adding them to 'preload' in configuration.
You should check if there is realy no database related code executed in your scenarios (user privileges, dbsession, or maybe even instantiating activerecord model - it fetches table structure from database)
red
1

#3 User is offline   piotrch 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-March 13

Posted 06 March 2013 - 08:27 AM

Thanks for your answer redguy. I didn't know that.
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