Size
Shared memory needs to be large enough to contain all of the application's Managed objects, the runtime state, and any in-flight transactions. See the ActiveSpaces® Transactions Sizing Guide for information on how to determine the correct size.
When caching Managed objects, shared memory only needs to be large enough to store the sub-set of cached Managed objects.
mmap
By default ActiveSpaces® Transactions
uses a normal file in the file system.
The mmap(2)
system call is used to map it into the
address space of the ActiveSpaces® Transactions
processes.
In a development environment, this is very convenient. Many developers may share a machine, and the operating system will only allocate memory as it is actually utilized in the shared memory files. Cleanup of stranded deployments (where the processes are gone but the shared memory file remains) may be as simple as removing file system directories.
A performance disadvantage when using mmap'd files for shared memory is that the operating system will spend cycles writing the memory image of the file to disk. As the size of the shared memory file and the amount of shared memory accessed by the application increases, the operating system will spend more and time writing the contents to disk.
ActiveSpaces® Transactions is not supported running from a networked file system (e.g. NFS). |
System V Shared memory
ActiveSpaces® Transactions also supports using System V Shared Memory for its shared memory.
To reclaim System V Shared Memory the ActiveSpaces® Transactions
node must
be stopped and removed using the |
An advantage of using System V Shared Memory is that the operating system does not spend any cycles attempting to write the memory to disk.
Another advantage is that the memory is allocated all at once by the operating system and cannot be swapped. In some cases this also allows the operating system to allocate the physical memory contiguously and use the CPU's TLB (translation lookaside buffer) more efficiently. On Solaris this occurs automatically. See the section called “Linux Huge Page TLB support” for Linux tuning information.
See the section called “Linux System V Shared Memory Kernel Tuning” for details on tuning Linux System V Shared Memory kernel parameters.
Managed objectss upport caching of a subset of the object data in shared memory. The cache size should be set so that it is large enough to allow a working set of objects in shared memory. This will avoid having to constantly refresh object data from a remote node or an external data store, which will negatively impact performance. ActiveSpaces® Transactions uses a LRU (least recently used) algorithm to evict objects from shared memory, so objects that are accessed most often will remain cached in shared memory.