mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
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
This commit is contained in:
@@ -70,11 +70,13 @@ extern shm_mq *shm_mq_get_queue(shm_mq_handle *mqh);
|
||||
|
||||
/* Send or receive messages. */
|
||||
extern shm_mq_result shm_mq_send(shm_mq_handle *mqh,
|
||||
Size nbytes, const void *data, bool nowait);
|
||||
extern shm_mq_result shm_mq_sendv(shm_mq_handle *mqh,
|
||||
shm_mq_iovec *iov, int iovcnt, bool nowait);
|
||||
Size nbytes, const void *data, bool nowait,
|
||||
bool force_flush);
|
||||
extern shm_mq_result shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov,
|
||||
int iovcnt, bool nowait, bool force_flush);
|
||||
extern shm_mq_result shm_mq_receive(shm_mq_handle *mqh,
|
||||
Size *nbytesp, void **datap, bool nowait);
|
||||
extern void shm_mq_flush(shm_mq_handle *mqh);
|
||||
|
||||
/* Wait for our counterparty to attach to the queue. */
|
||||
extern shm_mq_result shm_mq_wait_for_attach(shm_mq_handle *mqh);
|
||||
|
||||
Reference in New Issue
Block a user