DEV Community

Mike
Mike

Posted on

Running on the edge analysis

Following up to my last post, we plunged and have been running a beta on the edge, here’s how we did it:

We started deploying edge servers, our biggest issue was concerning data sync, we wanted to have a system where the edge users could interact, post data without losing it. We use a proprietary tool to keep us in sync, but our first prototype of said tool was SQLite with no rowids, and redis to queue messages - each edge node had this running and we used this as a source of truth. The edge would POST every half hour to the backend server, we’d obtain rowids, and sync our database back in line with the master.

It worked, but we hit a big huccup: our master was assigning rowids that conflicted with edges; this was overcame by dropping our reliance on rowids all together, and using a new unique token (UUID), formatted similar to: EDGENODE-LOC-NNLL-{rand x 8}-{DMYHIS}, it worked well, and helps reduce conflicts.

We next wanted to solve the issue of pretty URL addresses, we opted to create unique slugs based on some attribute (ie: section-title-NNLL), this gave us URLs like: /admin/content-editor/page/example-page-43ax

Finally, keeping all our edges in sync: we opted for a non-standard strategy of:

Masters can PUSH and PULL

Nodes (host machine) can PUSH and PULL, restricted to a list of trusted nodes, and key authentication only

Edges can PULL but cannot PUSH except to other edges in that “farm” of servers

Latency

For our beta users, we dropped our average response time from 230ms to 43ms - a massive improvement, and our customers who rely on the speed are thankful for it

Negative feedback

Like all products, we got a handful of negative feedback, the biggest was our delivery cycle to keep edges updated. We try heavily on LXD, Docker and Kubernetes. We had kept Kubernetes for our caching edge, and went straight to docker and lxd for delivering the application.

We decided to deploy Kubernetes and configure rolling updates, and made our release cycle smooth - there was some quirks in configuring - but that’s for another post!

P.s. we’ll post weekly updates on the edge here on Dev

Top comments (0)