Closed Bug 814251 Opened 13 years ago Closed 12 years ago

[email/IMAP] implement IMAP pipelining of FETCH requests to reduce latency

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect)

defect
Not set
normal

Tracking

(blocking-b2g:tef+, b2g18 fixed, b2g18-v1.0.1 verified)

VERIFIED FIXED
blocking-b2g tef+
Tracking Status
b2g18 --- fixed
b2g18-v1.0.1 --- verified

People

(Reporter: asuth, Assigned: jlal)

References

Details

(Keywords: perf)

Attachments

(1 file)

The IMAP library we are currently using does not pipeline requests. If we say "A01 UID FETCH 1 ...", "A02 UID FETCH 2 ...", we will not send the request for the second fetch until the first fetch has fully completed with "A01 OK". This introduces network latency into our synchronization process that is not required. This happens primarily during body part fetching where we issue separate fetch requests for body pats independently. When a message contains multiple body parts we currently split them into separate FETCH requests because of another deficiency in the IMAP lib relating to a fetch request that returns multiple literals (that I may have already resolved?), which is silly and we don't need to do. But otherwise, we issue body fetches from newest to oldest which is desirable, especially in the face of IMAP servers like Dovecot that always sort the UIDs we provide and return results in that order rather than the order we request. (Note: This was also partially done because a FETCH request of multiple UIDs can still only specify one set of part numbers to fetch, so in theory each message may have different body part numbers, although in practice coalescing is possible.) To try and improve a gmail unit test_compose.js test run which was taking a rather long time, I quick-hack implemented a naive implementation that can be seen here: https://github.com/asutherland/gaia-email-libs-and-more/tree/naive-imap-pipelining It works for gmail, especially given the consistent 100+ms latencies on turning around the I/O requests. However, it is way too naive for dovecot which can end up returning all the fetch results and only then issuing all the "OK" results.
Blocks: 852226
Attached patch Github PRSplinter Review
Some lame tests (which could be removed or improved) and tons of manual testing on my own Zimbra/Gmail accounts... Initial working version likely some tests are still failing but ready for review.
Attachment #732183 - Flags: review?(bugmail)
Assignee: nobody → jlal
blocking-b2g: --- → tef?
tef+ as this will help email perf which is a blocking issue at this point.
blocking-b2g: tef? → tef+
Attachment #732183 - Flags: review?(bugmail) → review+
Uplifted commit 320a0f6a3738cb4dffbe7ba22a8510a2cbd10351 as: v1-train: 1238936b68807c2b0a9482d27896822cde1547ce v1.0.1: 22b9acfdb8723cb1b1c140da5cdaf943f3da907b
This appears to be ok from a user perspective. Would need white box testing numbers to provide a more detailed picture of the improvements gained here.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: