On Wed, 2005-08-24 at 10:31 +1000, Badai Aqrandista wrote: > Anyway, to fix this, I'm trying to make my onw shared memory with > Apache::SharedMem.
Don't use that module. It's very inefficient. > But it seems that shared memory is just a memory area > that any process can read from or write to, not a memory that can become > part of any process's memory space. > > I'd like to put the read only data in a memory area that can become part of > any process's memory space, like threads sharing memory space. Is there any > way I can do that? You can share read-only data by loading it into normal variables during startup. You can share read/write data by keeping it in a database (including things like BerkeleyDB or Cache::FastMmap) and only reading the small parts of it that you need in each process. There is no way to access data in perl without the size of the process you read the data from allocating memory to hold that data while you use it. In other words, shared memory is not useful for reducing the size of existing processes unless those processes are currently each holding a lot of data that they never use. > Does this sound like fixing the wrong problem? Yes. Put a reverse proxy in front of your server, tune MaxClients so you won't go into swap, and then benchmark to see how much load you can handle. Then think about tuning. - Perrin
