There are only two places you can store data, disk(hard drive) and memory(RAM). If you use to much memory, then the system will put the information on disk in the pagefile and you are not getting anywhere. All you are doing is pushing the problem around, you are not necessarily improving performance.
If you want to improve performance, do benchmark tests FIRST do see what and where your performance issues are before implementing a solution without understanding the problem.
Refer to the discussion on the XY Problem which is what you are really doing
| [reply] |
| [reply] |
You are making guesses about what will be faster. Have you done any benchmarks? In my benchmarks, simple database access with MySQL based on a primary key is faster than the shared memory options available for Perl. This is because the perl data has to be serialized before writing to shared memory and de-serialized on the other end, and because the memory chunks tend to be quite large and require reading or writing much more data than the small piece needed for a single session.
If you are really having problems with the performance of database storage (and have already followed the performance suggestions in the DBI documentation) you should look at BerkeleyDB, which uses shared memory for caching. That's the fastest option. Cache::FastMmap is also fast, but is a cache and can drop data if it gets full, so think about how you plan to use it. | [reply] |
Hi,
I wouldn't do that
You don't need to do transactions on the DB, you just need to lookup, if something get modified (added a new product to the basket, f.e., then you do an update)... Accessing to a local database to do a lookup of data, sometimes is faster than looking up on the fs (for example if you have to schedule files or so)... The FS one is the simpliest and it works in any case...
If you use shared mem, you could use the key of the session itself to identify it, but things are thought for having an "amount" of users visiting the web, where it is not "the best way" to having a endless growing shared mem, only because you don't like the "normal" way of doing it. And don't forget that the amount of memory freed of a process will return to the interpreter, not the system...
Regards,
fmerges at irc.freenode.net
| [reply] |