Welcome Guest, Not a member yet? Register   Sign In
Ci_session with database or without database which one is more efficient
#1

Ci_session with database or without database which one is more efficient. My requirement is high performance in multiple database connection (db connection depends on user login type).
Reply
#2

AS it says in the CodeIgniter documentation regarding the uses of the 'files' driver, "A very basic test will probably trick you into believing that an SQL database is faster, but in 99% of the cases, this is only true while you only have a few current sessions. As the sessions count and server loads increase - which is the time when it matters - the file system will consistently outperform almost all relational database setups."

This is true in my observations. In addition, using files IMO makes it easier to implement a scheme to offload session garbage collection. PHP's random garbage collection is a performance bottleneck that can/should be avoided.

Memcached or Redis are good solutions also. These require more setup, care, and feeding than 'files' but offer great performance. On occasion they can get flakey. But when they work they work great.
Reply
#3

Also, if you have multiple web servers behind a load balancer, you need to use a database to maintain the session across all servers.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#4

(05-03-2019, 07:50 AM)samtron Wrote: Ci_session with database or without database which one is more efficient. My requirement is high performance in multiple database connection (db connection depends on user login type).

Hi, i'm interrested to know more about the implementation of your solution : db connection depends on user login type. 

thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB