Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  09 Nov 2021, Francesco Renga, Forum, Issue in data writing speed 
    Reply  10 Nov 2021, Stefan Ritt, Forum, Issue in data writing speed 
    Reply  26 Jan 2022, Konstantin Olchanski, Forum, Issue in data writing speed 
       Reply  26 Jan 2022, Konstantin Olchanski, Forum, Issue in data writing speed 
Message ID: 2301     Entry time: 10 Nov 2021     In reply to: 2299
Author: Stefan Ritt 
Topic: Forum 
Subject: Issue in data writing speed 
Midas uses various buffers (in the frontend, at the server side before the SYSTEM buffer, the SYSTEM buffer itself, on the 
logger before writing to disk. All these buffers are in RAM and have fast access, so you can fill them pretty quickly. When
they are full, the logger writes to disk, which is slower. So I believe at 2 Hz your disk can keep up with your writing 
speed, but at 4 Hz (2x8MBx4=32 MB/sec) your disk starts slowing down the writing process. Now 32MB/s is pretty slow for
a disk, so I presume you have turned compression on which takes quite some time.

To verify this, disable logging. The disable compression and keep logging. Then report back here again.

> Dear all,
>        I've a frontend writing a quite big bunch of data into a MIDAS bank (16bit output from a 4MP photo camera). 
> I'm experiencing a writing speed problem that I don't understand. When the photo camera is triggered at a low rate (< 2 Hz) 
> writing into the bank takes a very short time for each event (indeed, what I measure is the time to write and go back 
> into the polling function). If I increase the rate to 4 Hz, I see that writing the first two events takes a sort time, 
> but the third event takes a very long time (hundreds of ms), then again the fourth and fifth events are very fast, and 
> the sixth is very slow. If I further increase the rate, every other event is very slow. The problem is not in the readout 
> of the camera, because if I just remove the bank writing and keep the camera readout, the problem disappears. Can you 
> explain this behavior? Is there any way to improve it?
> Below you can also find the code I use to copy the data from the camera buffer into the bank. If you have any suggestion 
> to improve it, it would be really appreciated.
> Thank you very much,
>           Francesco
>   const char* pSrc = (const char*)bufframe.buf;
>   for(int y = 0; y < bufframe.height; y++ ){
>     //Copy one row
>     const unsigned short* pDst = (const unsigned short*)pSrc;
>     //go through the row
>     for(int x = 0; x < bufframe.width; x++ ){
>       WORD tmpData = *pDst++; 
>       *pdata++ = tmpData;
>     }
>     pSrc += bufframe.rowbytes;
>   }
ELOG V3.1.4-2e1708b5