Protonmail introduced high-performance Gluon IMAP library

Swiss company Proton AG, developing services Proton Mail and Proton VPN, introduced imip-biblioteum gluon , designed to create your own imap servers. The library supports the IMAP4REV1 protocol ( rfc-3501 ) and is involved in The new version of the service proton bridge . In development, the main attention is paid to the correctness of the implementation, stability, reliability, convenience for developers and high performance. The library code is written in GO and is distributed under the license mit.

The reason for the creation of a new implementation of the IMAP protocol mentions the desire to receive simultaneously a reliable and high -performance solution that can work with large mailboxes. According to Proton Mail developers, the existing open IMAP bibliotexes either experienced accompaniment problems or were not scaled.

Gluon also ensured the correct work simultaneously with several clients, for example, when the user simultaneously views mail via the Web interface and using a separate postal client. The complexity of the organization of such work is due to the fact that in IMAP to identify mail messages, serial numbers of messages in MailBox are used, but when one client deleted the message, the serial numbers are shifted and the other client must take this shift take into account. In such a situation, the server sends customers a notice of change, but before confirming the acceptance of notification, the server must ensure the correct interpretation of messages in messages in the transmitted teams.

to solve such a problem, as well as to organize the processing of several parallel connections from one client, the GLUUN has a mechanism of snapshots. The essence of this mechanism is that Gluon assigns its postal box (MailBox) behind each client. Each snapshot reflects MailBox unique representation, which retains its condition and guarantees the invariability of serial numbers, regardless of actions performed by other clients.

Gluon monitors the two states of the mailbox – permanent and session. The constant state reflects the real position of messages in the selected mailbox, and the session state reflects the idea of ​​each client about the contents of the mailbox. The IMAP state is stored in the DBMS that supports SQL. Beta testing of the Proton Mail Bridge service, transferred to Gluon, showed a significant (1000%) increase in the speed of work with IMAP.

/Media reports cited above.