Why Stalwart download so much from S3 each day

Your question

Hi,

During testing period we observed strange thing and that is Stalwart download in bursts large amount of data from S3 each day. For example just with 8GB of data on S3 it will generate each day 30-40GB of traffic each morning.

EDIT: Each morning, IMAP client connects and fetch 1000 messages. Again and again so great idea to know this before you select any S3 provider with egress fees :slight_smile:

But other question remains why Stalwart download whole blobs, would not be enough to have some metadata from database instead?

EDIT2: Checking 1.0.1 and it might fix this issue if Im seeing it correctly.

In 1.0 the envelope, the body structure and the headers of every message are kept in the database, so an IMAP client that fetches ENVELOPE, BODYSTRUCTURE, RFC822.HEADER or BODY.PEEK[HEADER.FIELDS (...)] gets them without a single S3 request. 0.16 also served headers that way, but it read the whole blob for BODYSTRUCTURE and BODY, and most clients ask for one of those when they sync a folder.

The blob is read only when the client asks for content: BODY[], BODY[TEXT], RFC822, a single MIME part or BINARY. Those bytes exist only in the blob store, so there is nothing a database lookup could return instead. If a client pulls the same 1000 full messages every morning, it’s throwing away its local cache and downloading them again, and that’s worth fixing on the client. Which client is it, and is it set to keep messages for offline use?