0

Is /dev/shm only for temp files? I have a lot of memory on my server and I think to use shared memory to store sphinx index files. How safe it is?

1 Answer 1

0

What do you mean by safe?

Of course it wont survive reboots (forced or planned). But in general sphinx index files are disposable. Can be recerated on demand by indexer - so can just run indexer on startup to create all the index files.

But it works just fine. Once written a file there the OS shouldnt remove it.

In practice I didnt find it provided much performance benefit. Searchd is quite well optimized to cope with 'slow' disks (eg caching the important stuff in memory anyway). YMMV of course!

(and because of that it does means some stuff will be duplicated in memory - once in /dev/shm and again in the searchd process. And you do have to account for this, dont want to cause machine to swap!)

Where it did make a more notiable difference was to indexing, which saw quite a performance jump writing to memory. But in general its write once, read meny. And indexing is performed 'offline' so the performance isnt as critical there.

2
  • I found some info over the web that don't suggest to use shared memory for that purpose as it can cause unpredictable bugs, system crash and so on... I just tried it and indexer was 20% faster. Aug 30, 2013 at 18:41
  • It might help to include links to those places. Sep 1, 2013 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.