Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The buffer is the center of the memory caching. It has FIFO eviction policy that has to be activated when the total memory size of all objects in the buffer is above the buffer maximum size. Furthermore, it needs to enable the indexing of elements into the indexing structure and perform the calculations that will return the size of all objects in the buffer. It is important that buffer is correctly synchronized and thread-safe, because it is an intention that many threads work on the buffer.

Approach

The operations of the buffer can be divided in two groups. First set of operation are the one that are invoked outside of a buffer, thus operations like put, clear, search, etc.

In the second group are operations that perform the "maintenance" in the buffer. These operations are:

  • analyze - perform the size calculation for one object in the buffer; this operation has to be suspended while the buffer is empty, or all elements in the buffer are analyzed
  • index - perform the indexing of one object in the buffer; this operation has to be suspended while the buffer is empty, or all elements in the buffer are indexed
  • evict - perform the eviction of one object in the buffer (by FIFO policy); this operation has to be suspended while the size of all objects in the buffer is smaller than the buffer maximum size

These "maintenance" operations should be done in separate threads. The intention is to explore the parallelism as much as possible, so that buffer can perform all of them at the same time, and be able to respond to the requests from "outer world".

Realization

Model