Event Buffer

From MidasWiki
Jump to navigation Jump to search


Increase size of events

In some experiments, the default event size (currently 4MiB) may not be large enough.

To increase the size of events, one must increase:

Actual limits on the bank size and event size are described below.

By default the shared memory event buffer (used to contain the data from the event) is named SYSTEM. Its default size is 8MB.

For very large events, it will also be necessary to increase the size of the SYSTEM buffer (and any buffers used by the event builder etc). Ultimately, the maximum event size is limited by the size of the SYSTEM buffer which is limited by the physical memory of your computer. No recompilation of MIDAS necessary.


Limits on the bank and event sizes

Limitations in order
  1. bank32 size is limited to a 32 bit integer size (about 4000 Gbytes)
  2. bank size is limited by event size
  3. event size in a Frontend based on MIDAS mfe.c is limited to the value of max_event_size set by the user
  4. maximum event size that can go through the MIDAS event buffer system is limited to ODB value /Experiment/MAX_EVENT_SIZE (Note that MAX_EVENT_SIZE in midas.h is no longer used).
  5. maximum event size is limited to half the size of the SYSTEM shared memory event buffer (or any other buffers that the event has to go through)
  6. default size of the SYSTEM buffer is 8 Mbytes set by ODB /Experiment/Buffer sizes/SYSTEM. This limits maximum event size to about 4 Mbytes.
  7. size of SYSTEM buffer can be increased to arbitrary size, but in practice no bigger than the amount of computer physical memory minus space needed for running the Frontend program and mlogger, which also allocate buffer space to hold 1 event of maximum size.


So for a computer with 8 Gbytes of RAM, you can make the SYSTEM buffer size 4 GBytes, set ODB MAX_EVENT_SIZE to 1 Gbyte, and in theory, you should be able to write 1 Gbyte events from your frontend to disk.

In practice, some of the biggest events to go through a MIDAS system are non-compressed waveforms in the T2K/ND280 FGD and TPC detectors, about 4 Mbytes of data per event.

Other considerations (rules of thumb)
  1. the SYSTEM event buffer should be big enough to hold 10-100 events.
  2. the SYSTEM event buffer should be big enough to hold about 5-10 seconds of data
i.e. if the event size is 1 Mbyte and data rate is 1 Hz, 10 seconds of data will be 1Mbyte*1Hz*10sec = 10 Mbytes.

This is because the SYSTEM buffer decouples the real-time activity of the Frontend program from non-real-time activity of writing data to storage devices.

Increase size of SYSTEM buffer

For large events it may be necessary to increase the size of the SYSTEM buffer. See note above.

  • shutdown all clients
  • set ODB key /Experiment/Buffer Sizes/SYSTEM to the larger value (a power of 2)
  • remove SYSTEM shared memory file .SYSTEM.SHM (located in directory given by #Exptab)
  • restart clients