• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to optimize SESSION on codeigniter ?

#1
hello folks

i have mid-range web application that serve at least 40.000 traffic per day ( based on google analytics ) 

i want to know whether you guys that already develop a mid or hi range kind of application also face this kind of problem like mine or not ?

i got an issue with CI session always taking so much resource in our database and sometimes causing a dead lock also 

currently we are using MYSQL database from AWS RDS

[Image: BJ983dp.png]


as you can see, there always a time when the session spiking and causing slow ( sometimes until deadlock ) in our web apps

and for your information

i also comment this line of code before to prevent session being locked cause if not it will become worse, our application will become super slow

[Image: ckxwQez.png]


please kindly share me a guidance on how to optimize CI Session using database

thank you
Reply

#2
Make sure your ci_sessions table are InnoDB as MyISAM can't be read and updated at the same time.
Does your ID column have an index?
Reply

#3
Thanks for the reply,

Yes i already implement indexing on ID as well as on the timestamp also
But once again the problem still occur due to the high traffic.
Reply

#4
(07-19-2019, 10:39 PM)oujisama Wrote: Thanks for the reply,

Yes i already implement indexing on ID as well as on the timestamp also
But once again the problem still occur due to the high traffic.

Maybe the documentation can help you: performance issues with sessions
Reply

#5
Hc-innov is right. Read this page carefully! It clearly says to NOT remove the lock and what to do instead:

Quote:you may conclude that locking is the issue and therefore look into how to remove the locks …

DO NOT DO THAT! Removing locks would be wrong and it will cause you more problems!

Locking is not the issue, it is a solution.
...
Long story short - call session_write_close() once you no longer need anything to do with session variables.
Test your translation files with Translation Tester
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.