Question

I have two PHP scripts that need to communicate. I know IPC in PHP isn't really a thing. I was thinking of ways to do it, and both scripts access the same database on a MySQL server. The communication does not need to be real time (but does need to be relatively fast).

I thought passing data back and forth through a table would be a good way to do it.

The issues: I'd like to ensure this table resides in memory only. The main database application is 70% read/30% write, but the writes are very rarely updates. The database will grow over time, but very rarely will anything ever be deleted. For speed, the databases are on SSDs. My concern with using a database for IPC is the constant writes and deletes - so I'd like to ensure the database is in memory only. No persistence is necessary.

I also know (am I correct?) that temporary tables are destroyed when a session closes - but they are also only available to the session that created them. So thats not an option.

Is there a way to make a table that never really hits the disk? I dont want to burn out a SSD 6 months from now because the IPC slammed the disk writes.

Was it helpful?

Solution

It sounds like you want the MySQL MEMORY storage engine:

CREATE TABLE [...] ENGINE=MEMORY;

Refer to the MySQL manual for details .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top