I want to use MySQL MEMORY storage engine to handle my PHP session variables (actually I already implemented it but since all my tests are being done by a single user, me, I am unable to notice this).
As it says here: http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html
MEMORY performance is constrained by contention resulting from single-thread execution and table lock overhead when processing updates. This limits scalability when load increases, particularly for statement mixes that include writes.
I don't understand this statement. It makes me think that when you insert/update/replace the table locks itself automatically and entirely so you will not be able to select anything while the write is being done. Is this correct? Can this be disabled? I need to write and read quite frequently and at the same time and I am not planning on doing transactions on this table:
CREATE TABLE `sessions` (
`id` varchar(255) NOT NULL,
`data` varchar(64000) NULL,
`expires` int(11) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`)
)ENGINE=MEMORY;
Since text max storage is 64Kb http://stackoverflow.com/questions/6766781/maximum-length-for-mysql-type-text
I've picked varchar(64000) because it is the equivalent, because MEMORY does not allow text.
Also I've been doing some math using this select: http://stackoverflow.com/questions/9620198/how-to-get-the-sizes-of-the-tables-of-a-mysql-database
With 1 register the table weight is 310Kb, with 10 is 610Kb. For 1000 rows I supose it will be 244 Mb.
– Cyberlover Apr 15 '16 at 15:17Previously I did something similar by mounting the PHP session folder in RAM and never had a problem. But that requires configuration on service level.
This is just an alternative I am testing in order to do the same in application level.
– Cyberlover Apr 15 '16 at 15:26