I have configured a couple of webmail applications (open source), to consult external email accounts (gmail). The applications are in Php and Mysql.
Once installed, I can link my mail through IMAP. And consult the mail from these applications.
Opening or reading a message is a request and it has taken me on average 1 to 2 seconds with the Roundcube application and GroupOffice.
With Rainloop and snappymail it went better, I got 150 to 350ms. Without optimizing anything in the installed applications, in all cases and with the same resources (cpu, ram and disk). Apparently the IMAP server is not a problem, as it is very fast.
I think the problem is in where the application has been installed, I think there are several things to optimize. I was checking the documentation and I find the following:
"Webmail systems make lots of imap connections. It's wise to use imapproxy to cache connections to the IMAP server. Install imapproxy on the web server and configure it to proxy the imap server." In addition I have read documentation where I am recommended to install: mem cache, redis, imapproxy.
I am tempted to install Sogo or Nextcloud, but without knowing what to optimize, I think I will get the same result.
My question is: What should I take care of, configure or optimize to get a fast query speed?