View Issue Details

IDProjectCategoryView StatusLast Update
0006210SOGowith SOGopublic2026-06-05 10:56
Reportermefestofel Assigned To 
PriorityhighSeveritymajorReproducibilitysometimes
Status newResolutionopen 
Platform[Server] LinuxOSDebianOS Version12
Summary0006210: High latency between Nginx and SOGo under concurrent load / Delayed response delivery
Description

We are experiencing intermittent, severe delays when loading the message list in the SOGo web interface.
To diagnose this, we configured extended logging in Nginx.
The metrics reveal a significant discrepancy between the time Nginx spends waiting for the backend and the actual processing time reported by SOGo.

Log Analysis Example:
Nginx Log:
email.xxx.xx - xx.xx.xx.26 - - [14/May/2026:17:00:17 +0300] "POST /SOGo/so/otgruzka@xxx.xx/Mail/0/folderINBOX/changes HTTP/2.0" 200 27 "https://email.hoster.by/SOGo/so/otgruzka@xxx.xx/Mail/view" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36" 2.149 uсt=0.000 uht=2.144 urt=2.144
SOGo Log:
May 14 17:00:17 sogod [3636941]: xx.xx.xx.26 "POST /SOGo/so/otgruzka@xxx.xx/Mail/0/folderINBOX/changes HTTP/1.0" 200 27/152 0.182 - - 0 - 17

As shown above, SOGo processed the request in 0.182 seconds, but Nginx recorded an upstream response time (uht/urt) of 2.144 seconds.
This leaves an unaccounted-backlog delay of 1.962 seconds (2.144 - 0.182).
In worst-case scenarios, the browser waits for a response for up to 30 seconds.

Questions:
Where is the request spending the remaining 0000015:0000002 seconds before or after SOGo processes it?
Could this indicate that requests are getting queued in WOListenQueueSize before hitting a worker, or is it an issue with response buffering in SOGo?
What adjustments or optimizations can we implement to resolve this latency bottleneck?

Additional Information

Environment Details:
OS: Debian 12
SOGo Version: 5.12.7.20260406-1SOGo
Configuration SOGo: PREFORK=300, WOListenQueueSize=600
Load Profile: Average of 600 concurrent connections

TagsNo tags attached.

Activities

mefestofel

mefestofel

2026-05-15 11:43

reporter   ~0018461

We noticed the following pattern: the problem starts when IMAP sessions end. During these few seconds, there are no requests processed in the SOGO log, only IMAP connections:
May 15 12:34:18 sogod [435544]: <0x0x5581cb6ddb70[NGImap4Client]> TLS started successfully.
We used the undocumented parameter NGImap4PoolingCleanupInterval=43200.
This helped reduce the frequency of the problem, but the issue itself persisted.

Christian Mack

Christian Mack

2026-05-28 09:22

developer   ~0018494

Did you try to disable IMAP4 pooling altogether?
NGImap4DisableIMAP4Pooling = YES;
You should see, if your IMAP server is the culprit or SOGo's pool.

You could also enable Debugging with
ImapDebugEnabled = YES;

mefestofel

mefestofel

2026-05-28 10:32

reporter   ~0018495

Several days ago, we disabled pooling by setting NGImap4DisableIMAP4Pooling=YES. According to our monitoring, SOGo-level latencies have now disappeared.
However, SOGo has started generating an excessive number of new connections to the IMAP server. This occasionally causes performance degradation on the server side.
Could you please analyze and optimize the IMAP session pooling cleanup mechanism to improve performance and prevent locking issues?

mefestofel

mefestofel

2026-05-28 11:11

reporter   ~0018496

We utilized the Codex AI assistant to identify and resolve latency issues.
It has modified the source code of the SOPE library and submitted a pull request to your repository https://github.com/Alinto/sope/pull/72
Could you please review it?

mefestofel

mefestofel

2026-06-05 10:56

reporter   ~0018502

We have compiled the modified SOPE source code into SOPE library files and deployed them across all our production servers to replace the original versions.
Over the past week of monitoring, we haven't encountered any issues related to IMAP session terminations.
Could you please review and approve our pull request? https://github.com/Alinto/sope/pull/72

Issue History

Date Modified Username Field Change
2026-05-14 14:51 mefestofel New Issue
2026-05-15 11:43 mefestofel Note Added: 0018461
2026-05-28 09:22 Christian Mack Note Added: 0018494
2026-05-28 10:32 mefestofel Note Added: 0018495
2026-05-28 11:11 mefestofel Note Added: 0018496
2026-06-05 10:56 mefestofel Note Added: 0018502