Anyone using Fauna with Workers?

How are your read latencies from Fauna?

I’m seeing erratic latencies from workers. Some read queries take as low as 15ms and the same query a bit later can be as high as 700ms. I’m referring to the latency between Fauna and the worker, not the total latency between the user the the worker.

For me that worker is executing in DFW which should be pretty close to the Fauna servers so anything above 100ms seems pretty ridiculous to be honest.

2 Likes

I’m not pushing much req, but during distributed load testing it was response time in EU is ~50-100ms (Towards the Amazon IE EU Datacenter). If you’re doing write and then read tests, then it’s about 500ms.

I still haven’t seen any slowdown due to the Worker, but I’ve not been testing in the Americas at all.

So I made a little test.

It’s a worker that simply reads a document from Fauna 50 times and then writes the averaged query latency on KV with the country where the request originated and the Cloudflare data center that served the worker.

Then I went to all those sites that test URL speeds in multiple locations around the world, triggered the worker URL multiple times, and made this report from the info dumped on KV.

Again, the average latency showed here is between the worker and Fauna.

AR  Average latency: 242 ms
-------------------------------------------------
 -  EZE  Average latency: 242 ms

AT  Average latency: 109 ms
-------------------------------------------------
 -  CDG  Average latency: 109 ms

AU  Average latency: 508 ms
-------------------------------------------------
 -  MEL  Average latency: 762 ms
 -  SYD  Average latency: 254 ms

BE  Average latency: 121 ms
-------------------------------------------------
 -  AMS  Average latency: 121 ms

CA  Average latency: 75 ms
-------------------------------------------------
 -  SEA  Average latency: 81 ms
 -  YYZ  Average latency: 69 ms

CN  Average latency: 136 ms
-------------------------------------------------
 -  LHR  Average latency: 136 ms

CZ  Average latency: 109 ms
-------------------------------------------------
 -  CDG  Average latency: 109 ms

DE  Average latency: 148 ms
-------------------------------------------------
 -  AMS  Average latency: 122 ms
 -  CDG  Average latency: 172 ms
 -  FRA  Average latency: 150 ms

ES  Average latency: 74 ms
-------------------------------------------------
 -  MAD  Average latency: 74 ms

FR  Average latency: 129 ms
-------------------------------------------------
 -  AMS  Average latency: 116 ms
 -  CDG  Average latency: 111 ms
 -  WAW  Average latency: 159 ms

GB  Average latency: 143 ms
-------------------------------------------------
 -  LHR  Average latency: 143 ms

HK  Average latency: 368 ms
-------------------------------------------------
 -  HKG  Average latency: 368 ms

ID  Average latency: 286 ms
-------------------------------------------------
 -  SIN  Average latency: 286 ms

IE  Average latency: 123 ms
-------------------------------------------------
 -  DUB  Average latency: 173 ms
 -  LHR  Average latency: 73 ms

IL  Average latency: 342 ms
-------------------------------------------------
 -  TLV  Average latency: 342 ms

IN  Average latency: 450 ms
-------------------------------------------------
 -  SIN  Average latency: 450 ms

IT  Average latency: 212 ms
-------------------------------------------------
 -  ATH  Average latency: 287 ms
 -  FCO  Average latency: 221 ms
 -  FRA  Average latency: 127 ms

JP  Average latency: 250 ms
-------------------------------------------------
 -  NRT  Average latency: 250 ms

KR  Average latency: 293 ms
-------------------------------------------------
 -  NRT  Average latency: 293 ms

MX  Average latency: 37 ms
-------------------------------------------------
 -  DFW  Average latency: 61 ms
 -  QRO  Average latency: 14 ms

NL  Average latency: 118 ms
-------------------------------------------------
 -  AMS  Average latency: 118 ms

NO  Average latency: 187 ms
-------------------------------------------------
 -  CPH  Average latency: 187 ms

NZ  Average latency: 287 ms
-------------------------------------------------
 -  AKL  Average latency: 287 ms

RU  Average latency: 109 ms
-------------------------------------------------
 -  AMS  Average latency: 109 ms

SE  Average latency: 120 ms
-------------------------------------------------
 -  AMS  Average latency: 120 ms

SG  Average latency: 373 ms
-------------------------------------------------
 -  SIN  Average latency: 373 ms

US  Average latency: 137 ms
-------------------------------------------------
 -  DFW  Average latency: 47 ms
 -  EWR  Average latency: 104 ms
 -  GRU  Average latency: 192 ms
 -  HNL  Average latency: 205 ms
 -  IAD  Average latency: 65 ms
 -  MIA  Average latency: 158 ms
 -  SEA  Average latency: 92 ms
 -  SYD  Average latency: 235 ms
1 Like

Hm, interesting. I’m seeing much higher Worker initialization times as well on the same code.

From when I took the last load tests:
Image 2020-05-21 at 5.24.05 PM

Recent worker requests:
Image 2020-05-21 at 5.25.14 PM

(The initialization is when “user” is first timed, it just does basic input checks)

This is quite a large difference, hard to test if it’s changed overall. Cloudflare would know though.

2 Likes

Thanks for those numbers.

In my latency numbers I’m only considering the queries to Fauna though (obviously after the Worker has been initialized).

1 Like

I’m always trying to measure every step, or it’s impossible to debug what’s causing the latency.

We have to consider the nature of serverless though, we always have to factor in TTFB, DNS, SSL, Routes, packetloss etc. on every request. If you’d have a constant database socket connection, the latency would of course be very different.

How do you measure the worker init latency? Locally from your machine or is there a service that does this from multiple locations?

The test system client log the start-time and compares to worker time.
Not fully reliable, but I get an estimate at least.

1 Like