shm_mq: Update mq_bytes_written less often.
Robert Haas <rhaas@postgresql.org>
shm_mq: Update mq_bytes_written less often. Do not update shm_mq's mq_bytes_written until we have written an amount of data greater than 1/4th of the ring size, unless the caller of shm_mq_send(v) requests a flush at the end of the message. This reduces the number of calls to SetLatch(), and also the number of CPU cache misses, considerably, and thus makes shm_mq significantly faster. Dilip Kumar, reviewed by Zhihong Yu and Tomas Vondra. Some minor cosmetic changes by me. Discussion: http://postgr.es/m/CAFiTN-tVXqn_OG7tHNeSkBbN+iiCZTiQ83uakax43y1sQb2OBA@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/tqueue.c | modified | +1 −1 |
| src/backend/libpq/pqmq.c | modified | +6 −1 |
| src/backend/storage/ipc/shm_mq.c | modified | +52 −10 |
| src/include/storage/shm_mq.h | modified | +5 −3 |
| src/test/modules/test_shm_mq/test.c | modified | +4 −3 |
| src/test/modules/test_shm_mq/worker.c | modified | +1 −1 |
Discussion
- Gather performance analysis 41 messages · 2021-08-06 → 2021-10-26