File util-linux-libuuid-extend-cache.patch of Package python3-libmount.32042

From 0f8de4902fe3f3512ee5043c5277d002a488a804 Mon Sep 17 00:00:00 2001
From: Michael Trapp <michael.trapp@sap.com>
Date: Thu, 10 Mar 2022 13:18:52 +0100
Subject: [PATCH] libuuid:  extend cache in uuid_generate_time_generic()

Improve throughput and reduce clock sequence increments
for high load situation with time based version 1 uuids.

In a high load scenario, where an application continiously reads time
based version 1 uuids from uuidd, we have noticed the following
behaviour.

The application reads more uuids as there are available in the
corresponding timeframe and each bulk request results in an increment of
the clock sequence because of the 'step back' in time. Due to the
14bit size of the clock sequence this also results in overflows of
the clock sequence.

As uuidd calls
    uuid_generate_time_safe()
       uuid_generate_time_generic()
the default value for the bulk request in the '#ifdef HAVE_TLS' section
of uuid_generate_time_generic() is set to 1000.

Extending the 'cache' of uuid_generate_time_generic() by increasing
the default of num to 1000000 doesn't solve the issue, but reduces
the clock sequence increments by factor 1000 and it also improves
the uuid throughput in our setup by factor 3-4.

It might be possible to implement a cache for
  UUIDD_OP_BULK_TIME_UUID
  UUIDD_OP_TIME_UUID
in the uuidd request handling, but it would not be as simple as this fix
in uuid_generate_time_generic().

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 libuuid/src/gen_uuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index d353fa1a0..76d5371ea 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -453,7 +453,7 @@ static int uuid_generate_time_generic(uuid_t out) {
 			num = 0;
 	}
 	if (num <= 0) {
-		num = 1000;
+		num = 1000000;
 		if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID,
 					out, &num) == 0) {
 			last_time = time(NULL);
-- 
2.35.1

openSUSE Build Service is sponsored by