Try OpenEdge Now
skip to main content
Database Essentials
Administrative Planning : Memory usage : Estimating memory requirements : Understanding memory internals
Understanding memory internals
The primary broker process allocates shared memory for users to access data within the database. The users also use structures within memory to allow for concurrent access to information without corrupting this information. For example, two users who want to update the same portion of memory with different updates could lead to shared memory corruption. Latches prevent this corruption, similar to a lock. When a process locks a record, it is allowed to update the record without interference from other processes trying to make simultaneous changes. A latch is a lock in shared memory that allows a user to make modification to a memory block without being affected by other users.
Figure 20 shows an example of shared memory resources. This illustration should only be considered an example because it is incomplete and is not to scale. Database buffers account for more than 90 percent of shared memory, and the various latch control structures account for less than 1 percent.
Figure 20. Shared memory resources example
As Figure 20 illustrates, there are many resources inside of shared memory. Local users (both end-user processes and batch processes) update these structures. If two users access this database simultaneously and both users want to make an update to the lock table (-L), the first user requests the resource by looking into the latch control table. If the resource is available, the user establishes a latch on the resource using an operating system call to ensure that no other process is doing the same operation. Once the latch is enabled, the user makes the modification to the resource and releases the latch. If other users request the same resource, they must retry the operation until the resource latch is available.
The database buffers are vitally important. They provide a caching area for frequently accessed portions of the database so that information can be accessed from disk once and from memory several times. Because memory is so much faster than disk, this provides an excellent performance improvement to the user when tuned properly.
The other processes shown in Figure 20 are page writers. These Asynchronous Page Writer (APW) processes write modified database buffers to disk. You can have more than one APW per database. The other writers, After-image Writer (AIW) and Before-image Writer (BIW), write after-image and before-image buffers to disk. There can only be a single BIW and a single AIW per database.
Figure 21 illustrates how the process of adding remote clients adds a TCP/IP listen socket and server processes. The remote clients send a message to the listen socket, which in turn alerts the broker process. The broker process references both the user control table and the server control table to determine if the user can log in, and to which server the user can attach. If a server is not available, one server is started, depending on the server parameters for this broker. Parameters such as -Mn, -Mi, and -Ma, control the number of servers a broker can start, the number of clients a server can accept, and when new servers are started. See OpenEdge Data Management: Database Administration for details. Once the proper server has been determined, a bi-directional link opens between that server and the remote client. This link remains open until the user disconnects or until the broker is shut down.
Figure 21. Shared memory resource—adding remote clients