Extension APC and Custom Mmap

Ok, so I'm working on this project, which requires me to do a search in the memory key store in the table. The business rules that I work with also indicate that this table should be read from memory on each individual node, and the table should be stored in several queries.

So the obvious solution is to use APC with apc_fetch (); and apc_store ();

The problem is that the table will consist of thousands and thousands of key pairs and will be the size of a couple megabytes (the machines on which it will work are a memory behemoth)

So, I have some performance issues if APC serializes the user cache at boot.

If this is not so, then it should not be so large, and then it will be in fact a more optimal solution.

However, if there wasn’t a better alternative to writing a custom extension in C that performed a binary search in a sorted file of structures stored on disk?

Or (hopefully) writes that the user extension is simply not worth it.

Victories, losses, quick thoughts?

Thank you in advance

+4
source share
2 answers

Although APC will serialize at boot time, the actual search through apc_fetch() is through a hash table and should not contain any bottlenecks that you describe. Since your machines are a memory behemoth, you should consider setting APC tables large enough to keep all your key / value pairs in memory. This can be done by setting apc.user_entries_hint in php.ini to the appropriate value for your application.

0
source

Try to find https://serverfault.com/questions/57915/ram-disk-and-physical-raid Basically look at tmpfs on linux and use it as a regulat file system with any rules you want. It is also easy to debug and verify outside the application.

0
source

Source: https://habr.com/ru/post/1341737/


All Articles