Score:3

RAM has become very slow low write speed and high latency

bv flag

I have identified an issue with memory speeds and latency on my server. I am renting this server from OVH and one of their requirements before getting the RAM replaced is

To launch an intervention, you need to send logs in your ticket showing the identifiant and the affected RAM module.

How am I able to detect the DRAM chip which is faulty without running memtest86+ for days as this is a large (1TB RAM) production server.

sysbench --test=memory --memory-block-size=4G --memory-total-size=32G run

WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Running memory speed test with the following options:
  block size: 4194304KiB
  total size: 32768MiB
  operation: write
  scope: global

Initializing worker threads...

Threads started!

Total operations: 2 (    0.15 per second)

8192.00 MiB transferred (630.16 MiB/sec)


General statistics:
    total time:                          12.9937s
    total number of events:              2

Latency (ms):
         min:                                 6338.94
         avg:                                 6496.29
         max:                                 6653.64
         95th percentile:                     6594.16
         sum:                                12992.58

Threads fairness:
    events (avg/stddev):           2.0000/0.00
    execution time (avg/stddev):   12.9926/0.00

sysbench --test=memory --memory-block-size=1K --memory-total-size=100G --num-threads=1 run

WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Running memory speed test with the following options:
  block size: 1KiB
  total size: 102400MiB
  operation: write
  scope: global

Initializing worker threads...

Threads started!

Total operations: 48693603 (4868132.10 per second)

47552.35 MiB transferred (4754.04 MiB/sec)


General statistics:
    total time:                          10.0002s
    total number of events:              48693603

Latency (ms):
         min:                                    0.00
         avg:                                    0.00
         max:                                    0.47
         95th percentile:                        0.00
         sum:                                 4155.88

Threads fairness:
    events (avg/stddev):           48693603.0000/0.00
    execution time (avg/stddev):   4.1559/0.00

sudo lshw -short -C memory

H/W path            Device      Class          Description
==========================================================
/0/0                            memory         64KiB BIOS
/0/20                           memory         1TiB System Memory
/0/20/0                         memory         [empty]
/0/20/1                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/2                         memory         [empty]
/0/20/3                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/4                         memory         [empty]
/0/20/5                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/6                         memory         [empty]
/0/20/7                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/8                         memory         [empty]
/0/20/9                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/a                         memory         [empty]
/0/20/b                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/c                         memory         [empty]
/0/20/d                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/20/e                         memory         [empty]
/0/20/f                         memory         128GiB DIMM DDR4 Synchronous LRDIMM 2933 MHz (0.3 ns)
/0/23                           memory         3MiB L1 cache
/0/24                           memory         24MiB L2 cache
/0/25                           memory         256MiB L3 cache
Score:1
gn flag

This is more of a long comment than an answer. Maybe it will stimulate other suggestions. The basic idea being to reserve and allocate memory such that sysbench then has to use a different area of memory for its memory block buffer to observe if the performance is the same over all memory.

The test system only has 32G of memory on 4X8G DIMMs.

First, just run sysbench normally, but increase the test duration enough for time to acquire some information while it executes:

doug@s19:~/c$ sysbench --test=memory --memory-block-size=4G --memory-total-size=512G --num-threads=1 --time=60 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Running memory speed test with the following options:
  block size: 4194304KiB
  total size: 524288MiB
  operation: write
  scope: global

Initializing worker threads...

Threads started!

Total operations: 128 (    3.05 per second)

524288.00 MiB transferred (12509.51 MiB/sec)


General statistics:
    total time:                          41.9101s
    total number of events:              128

Latency (ms):
         min:                                  327.22
         avg:                                  327.42
         max:                                  328.09
         95th percentile:                      325.98
         sum:                                41909.72

Threads fairness:
    events (avg/stddev):           128.0000/0.00
    execution time (avg/stddev):   41.9097/0.00

And during the 41 seconds that the test took to execute and in another terminal I did this:

doug@s19:~$ ps aux | grep sysbench
doug       10489 92.2 12.8 4227496 4204436 pts/1 Sl+  09:48   0:03 sysbench --test=memory --memory-block-size=4G --memory-total-size=512G --num-threads=1 --time=60 run
doug       10492  0.0  0.0   9040   732 pts/2    S+   09:48   0:00 grep --color=auto sysbench
doug@s19:~$ pmap 10489 | grep anon | grep " 4195"
00007f25cbb5a000 4195456K rw---   [ anon ]

I did the whole cycle a few times:

00007fa4bd7b4000 4195456K rw---   [ anon ]
00007f32c9878000 4195456K rw---   [ anon ]
00007f4837211000 4195456K rw---   [ anon ]

which shows we really don't know what memory is used or the mapping back to DIMM. Let's continue anyhow.

EDIT: the above can be made repeatable, by disabling Address Space Layout Randomization (ASLR):

sudo sysctl kernel.randomize_va_space=0

Now, reserve some chunk of memory so as to force the sysbench buffer to be allocated elsewhere. Someone might have a better idea, but I wrote a program:

doug@s19:~/c$ cat reservem.c
/*****************************************************************************
*
* reservem.c 2021.07.20 Smythies
*       allocate a chunk of memory for a while.
*       current use is to force another program to use a different area
*       of memory.
*       see also: https://askubuntu.com/questions/1352756/ram-has-become-very-slow-low-write-speed-and-high-latency
*       see slao testm.c from which this code started.
*
*****************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(){
   char *fptr;
   long i, k;

/* Adjust as needed for use requirements */
   i = 8589934592;

   if(( fptr = (char *)malloc(i)) == NULL){
      printf("reservem: memory allocation failed, Exiting...\n");
      exit(-1);
   }
   while (( fptr == NULL) && (i > 0));
   for(k = 0; k < i; k++){   /* so that the memory really gets allocated and not just reserved */
      fptr[k] = (char) (k & 255);
   } /* endfor */
   printf("reservem: memory reserved and allocated. now sleeping...\n");
   sleep(180);  /* so other tests and observation can be done. Adjust as required. */
   free(fptr);
   printf("reservem: memory has been set free. Done and exiting...\n");
   return(0);
} /* endprogram */

Compiled it:

doug@s19:~/c$ cc reservem.c -o reservem

then ran it and then redid the previous steps while the memory block was reserved and allocated. Getting:

doug@s19:~$ ps aux | grep sysbench
doug       11324 93.8 12.8 4227496 4204340 pts/1 Sl+  13:58   0:09 sysbench --test=memory --memory-block-size=4G --memory-total-size=512G --num-threads=1 --time=60 run
doug       11327  0.0  0.0   9040   664 pts/2    S+   13:59   0:00 grep --color=auto sysbench
doug@s19:~$ pmap 11324 | grep anon | grep " 4195"
00007fc5f2df8000 4195456K rw---   [ anon ]

And for the memory reserved:

doug@s19:~$ ps aux | grep reservem
doug       11314 55.0 25.6 8391108 8389584 pts/0 S+   13:57   0:11 ./reservem
doug       11318  0.0  0.0   9040   740 pts/2    S+   13:57   0:00 grep --color=auto reservem
doug@s19:~$ pmap 11314 | grep anon | grep " 8388612K"
00007f11a6bfc000 8388612K rw---   [ anon ]

And:

524288.00 MiB transferred (12499.79 MiB/sec)

Similarly for reserving and allocating 2 and 3 times 8G:

doug@s19:~$ ps aux | grep reservem
doug       11335 85.0 25.6 8391108 8389704 pts/0 S    14:07   0:11 ./reservem
doug       11336 92.0 25.6 8391108 8389672 pts/0 S    14:07   0:11 ./reservem
doug       11340  0.0  0.0   9040   736 pts/2    S+   14:08   0:00 grep --color=auto reservem
doug@s19:~$ pmap 11335 | grep anon | grep " 8388612K"
00007fae2ce3f000 8388612K rw---   [ anon ]
doug@s19:~$ pmap 11336 | grep anon | grep " 8388612K"
00007f20cb627000 8388612K rw---   [ anon ]
doug@s19:~$ ps aux | grep sysbench
doug       11347 96.6 12.8 4227496 4204468 pts/1 Sl+  14:08   0:12 sysbench --test=memory --memory-block-size=4G --memory-total-size=512G --num-threads=1 --time=60 run
doug       11350  0.0  0.0   9040   740 pts/2    S+   14:08   0:00 grep --color=auto sysbench
doug@s19:~$ pmap 11347 | grep anon | grep " 4195"
00007f37dbe3c000 4195456K rw---   [ anon ]

and:

524288.00 MiB transferred (12521.74 MiB/sec)

3X:

doug@s19:~$ ps aux | grep reservem
doug       11388  100 21.0 8391108 6889064 pts/0 R    14:12   0:09 ./reservem
doug       11389  103 19.2 8391108 6292368 pts/0 R    14:12   0:08 ./reservem
doug       11390  100 16.3 8391108 5334328 pts/0 R    14:12   0:07 ./reservem
doug       11392  0.0  0.0   9040   724 pts/2    S+   14:12   0:00 grep --color=auto reservem
doug@s19:~$ pmap 11388 | grep anon | grep " 8388612K"
00007f2b83d2d000 8388612K rw---   [ anon ]
doug@s19:~$ pmap 11389 | grep anon | grep " 8388612K"
00007f2921e0c000 8388612K rw---   [ anon ]
doug@s19:~$ pmap 11390 | grep anon | grep " 8388612K"
00007f2a23f2b000 8388612K rw---   [ anon ]
doug@s19:~$ ps aux | grep sysbench
doug       11402  107 12.8 4227496 4204420 pts/1 Sl+  14:12   0:07 sysbench --test=memory --memory-block-size=4G --memory-total-size=512G --num-threads=1 --time=60 run
doug       11405  0.0  0.0   9040   672 pts/2    S+   14:12   0:00 grep --color=auto sysbench
doug@s19:~$ pmap 11402 | grep anon | grep " 4195"
00007fe64b54b000 4195456K rw---   [ anon ]

and:

524288.00 MiB transferred (12504.34 MiB/sec)

For reference, performance on this system verses memory-block-size:

Block-size: performance (MiB/sec):
256            2750.99
512            4937.70
  1K           8216.82
  2K          12290.93
  4K          16334.92
  8K          19498.37
 16K          21663.68
 32K          22514.94
 64K          23372.45
128K          23815.14
256K          23967.98
512K          24126.43
  1M          24226.70
  2M          24279.93
  4M          24310.19
  8M          23632.07
 16M          20622.04
 32M          16149.71
 64M          14206.06
128M          13303.15
256M          12853.12
512M          12720.34
  1G          12584.68
  2G          12538.66
  4G          12502.66
  8G          12490.63
 16G          12482.25
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.