File 0580-Add-read_concurrency-to-ssl_otp_cacertificate_db.patch of Package erlang

From 4d2fd37f33a83819d7261925e6e3a471e799659c Mon Sep 17 00:00:00 2001
From: John Altenmueller <jaltenmueller@whatsapp.com>
Date: Thu, 30 Nov 2023 16:51:30 -0800
Subject: [PATCH] Add read_concurrency to ssl_otp_cacertificate_db

We see lock contention on this table under high load, e.g.

```
> lcnt:inspect(db_tab, [{print, [id, colls, ratio, duration]}]).

                      id  #collisions  collisions [%]  duration [%]
                     --- ------------ --------------- -------------
ssl_otp_cacertificate_db         7827         12.5136      616.1264
     ssl_otp_ca_file_ref           30          0.2561        0.0026
```

Use read_concurrency as this is a read-heavy table and this has helped
reduce the lock contention seen here.
---
 lib/ssl/src/ssl_pkix_db.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ssl/src/ssl_pkix_db.erl b/lib/ssl/src/ssl_pkix_db.erl
index eac9e2a8b3..a6e27bd16f 100644
--- a/lib/ssl/src/ssl_pkix_db.erl
+++ b/lib/ssl/src/ssl_pkix_db.erl
@@ -53,7 +53,7 @@ create(PEMCacheName) ->
     [%% Let connection process delete trusted certs
      %% that can only belong to one connection. (Supplied directly
      %% on DER format to ssl:connect/listen.)
-     ets:new(ssl_otp_cacertificate_db, [set, public]),
+     ets:new(ssl_otp_cacertificate_db, [set, public, {read_concurrency, true}]),
      %% Let connection processes call ref_count/3 directly
      {ets:new(ssl_otp_ca_file_ref, [set, public]),
       ets:new(ssl_otp_ca_ref_file_mapping, [set, protected])
-- 
2.35.3

openSUSE Build Service is sponsored by