Tuesday, August 16, 2022
HomeBig DataHow Plugsurfing doubled efficiency and decreased price by 70% with purpose-built databases...

How Plugsurfing doubled efficiency and decreased price by 70% with purpose-built databases and AWS Graviton

Plugsurfing aligns the whole automobile charging ecosystem—drivers, charging level operators, and carmakers—inside a single platform. The over 1 million drivers related to the Plugsurfing Energy Platform profit from a community of over 300,000 charging factors throughout Europe. Plugsurfing serves charging level operators with a backend cloud software program for managing every thing from country-specific rules to offering various cost choices for purchasers. Carmakers profit from white label options in addition to deeper integrations with their in-house expertise. The platform-based ecosystem has already processed greater than 18 million charging classes. Plugsurfing was acquired absolutely by Fortum Oyj in 2018.

Plugsurfing makes use of Amazon OpenSearch Service as a central information retailer to retailer 300,000 charging stations’ data and to energy search and filter requests coming from cellular, internet, and related automobile dashboard shoppers. With the rising utilization, Plugsurfing created a number of learn replicas of an OpenSearch Service cluster to satisfy demand and scale. Over time and with the rise in demand, this answer began to develop into price exhaustive and restricted when it comes to price efficiency profit.

AWS EMEA Prototyping Labs collaborated with the Plugsurfing workforce for 4 weeks on a hands-on prototyping engagement to unravel this drawback, which resulted in 70% price financial savings and doubled the efficiency profit over the present answer. This submit reveals the general strategy and concepts we examined with Plugsurfing to realize the outcomes.

The problem: Scaling increased transactions per second whereas protecting prices underneath management

One of many key problems with the legacy answer was maintaining with increased transactions per second (TPS) from APIs whereas protecting prices low. Nearly all of the associated fee was coming from the OpenSearch Service cluster, as a result of the cellular, internet, and EV automobile dashboards use completely different APIs for various use circumstances, however all question the identical cluster. The answer to realize increased TPS with the legacy answer was to scale the OpenSearch Service cluster.

The next determine illustrates the legacy structure.

Plugsurfing APIs are liable for serving information for 4 completely different use circumstances:

  • Radius search – Discover all of the EV charging stations (latitude/longitude) with in x km radius from the focus (or present location on GPS).
  • Sq. search – Discover all of the EV charging stations inside a field of size x width, the place the focus (or present location on GPS) is on the middle.
  • Geo clustering search – Discover all of the EV charging stations clustered (grouped) by their focus inside a given space. For instance, looking out all EV chargers in all of Germany ends in one thing like 50 in Munich and 100 in Berlin.
  • Radius search with filtering – Filter the outcomes by EV charger which are out there or in use by plug kind, energy ranking, or different filters.

The OpenSearch Service area configuration was as follows:

  • m4.10xlarge.search x 4 nodes
  • Elasticsearch 7.10 model
  • A single index to retailer 300,000 EV charger places with 5 shards and one reproduction
  • A nested doc construction

The next code reveals the instance doc

   "adress":"parking zone 1",
               "plug_type":"Type A"

Resolution overview

AWS EMEA Prototyping Labs proposed an experimentation strategy to attempt three high-level concepts for efficiency optimization and to decrease total answer prices.

We launched an Amazon Elastic Compute Cloud (EC2) occasion in a prototyping AWS account to host a benchmarking device primarily based on k6 (an open-source device that makes load testing easy for builders and QA engineers) Later, we used scripts to dump and restore manufacturing information to numerous databases, remodeling it to suit with completely different information fashions. Then we ran k6 scripts to run and report efficiency metrics for every use case, database, and information mannequin mixture. We additionally used the AWS Pricing Calculator to estimate the price of every experiment.

Experiment 1: Use AWS Graviton and optimize OpenSearch Service area configuration

We benchmarked a reproduction of the legacy OpenSearch Service area setup in a prototyping surroundings to baseline efficiency and prices. Subsequent, we analyzed the present cluster setup and beneficial testing the next modifications:

  • Use AWS Graviton primarily based reminiscence optimized EC2 situations (r6g) x 2 nodes within the cluster
  • Scale back the variety of shards from 5 to 1, given the amount of information (all paperwork) is lower than 1 GB
  • Enhance the refresh interval configuration from the default 1 second to five seconds
  • Denormalize the complete doc; if not doable, then denormalize all of the fields which are a part of the search question
  • Improve to Amazon OpenSearch Service 1.0 from Elasticsearch 7.10

Plugsurfing created a number of new OpenSearch Service domains with the identical information and benchmarked them towards the legacy baseline to acquire the next outcomes. The row in yellow represents the baseline from the legacy setup; the rows with inexperienced characterize one of the best final result out of all experiments carried out for the given use circumstances.

DB EngineModelNode KindNodes in ClusterConfigurationsInformation ModelingRadius req/secFiltering req/secEfficiency Achieve %
Elasticsearch7.1m4.10xlarge45 shards, 1 reproductionNested28415800
Amazon OpenSearch Service1.0r6g.xlarge21 shards, 1 reproductionNested85027132.77
Amazon OpenSearch Service1.0r6g.xlarge21 shards, 1 reproductionDenormalized87267045.07
Amazon OpenSearch Service1.0r6g.2xlarge21 shards, 1 reproductionNested166747462.58
Amazon OpenSearch Service1.0r6g.2xlarge21 shards, 1 reproductionDenormalized1993126895.32

Plugsurfing was capable of acquire 95% (doubled) higher efficiency throughout the radius and filtering use circumstances with this experiment.

Experiment 2: Use purpose-built databases on AWS for various use circumstances

We examined Amazon OpenSearch Service, Amazon Aurora PostgreSQL-Suitable Version, and Amazon DynamoDB extensively with many information fashions for various use circumstances.

We examined the sq. search use case with an Aurora PostgreSQL cluster with a db.r6g.2xlarge single node because the reader and a db.r6g.massive single node as the author. The sq. search used a single PostgreSQL desk configured by way of the next steps:

  1. Create the geo search desk with geography as the info kind to retailer latitude/longitude:
CREATE TYPE standing AS ENUM ('out there', 'inuse', 'out-of-order');

id     serial PRIMARY KEY,
geog   geography(POINT),
standing standing,
information   textual content -- Can be utilized as json information kind, or add further fields as flat json

  1. Create an index on the geog subject:
CREATE INDEX global_points_gix ON square_search USING GIST (geog);

  1. Question the info for the sq. search use case:
SELECT id, ST_AsText(geog), standing, datafrom square_search
the place geog && ST_MakeEnvelope(32.5,9,32.8,11,4326) restrict 100;

We achieved an eight-times higher enchancment in TPS for the sq. search use case, as proven within the following desk.

DB EngineModelNode KindNodes in ClusterConfigurationsInformation modelingSq. req/secEfficiency Achieve %
Elasticsearch7.1m4.10xlarge45 shards, 1 reproductionNested4120
Aurora PostgreSQL13.4r6g.massive2PostGIS, DenormalizedSingle desk881213.83
Aurora PostgreSQL13.4r6g.xlarge2PostGIS, DenormalizedSingle desk1770429.61
Aurora PostgreSQL13.4r6g.2xlarge2PostGIS, DenormalizedSingle desk3553862.38

We examined the geo clustering search use case with a DynamoDB mannequin. The partition key (PK) is made up of three elements: <zoom-level>:<geo-hash>:<api-key>, and the kind secret’s the EV charger present standing. We examined the next:

  • The zoom stage of the map set by the consumer
  • The geo hash computed primarily based on the map tile within the consumer’s view port space (at each zoom stage, the map of Earth is split into a number of tiles, the place every tile may be represented as a geohash)
  • The API key to establish the API consumer
Partition Key: StringType Key: Stringtotal_pins: Quantityfilter1_pins: Quantityfilter2_pins: Quantityfilter3_pins: Quantity

The author updates the counters (increment or decrement) towards every filter situation and charger standing at any time when the EV charger standing is up to date in any respect zoom ranges. With this mannequin, the reader can question pre-clustered information with a single direct partition hit for all of the map tiles viewable by the consumer on the given zoom stage.

The DynamoDB mannequin helped us acquire a 45-times higher learn efficiency for our geo clustering use case. Nonetheless, it additionally added further work on the author aspect to pre-compute numbers and replace a number of rows when the standing of a single EV charger is up to date. The next desk summarizes our outcomes.

DB EngineModelNode KindNodes in ClusterConfigurationsInformation modelingClustering req/secEfficiency Achieve %
Elasticsearch7.1m4.10xlarge45 shards, 1 reproductionNested220
DynamoDBNAServerless0100 WCU, 500 RCUSingle desk10004545.45

Experiment 3: Use AWS Lambda@Edge and AWS Wavelength for higher community efficiency

We beneficial that Plugsurfing use Lambda@Edge and AWS Wavelength to optimize community efficiency by shifting among the APIs on the edge to nearer to the consumer. The EV automobile dashboard can use the identical 5G community connectivity to invoke Plugsurfing APIs with AWS Wavelength.

Submit-prototype structure

The post-prototype structure used purpose-built databases on AWS to realize higher efficiency throughout all 4 use circumstances. We seemed on the outcomes and break up the workload primarily based on which database performs greatest for every use case. This strategy optimized efficiency and value, however added complexity on readers and writers. The ultimate experiment abstract represents the database suits for the given use circumstances that present one of the best efficiency (highlighted in orange).

Plugsurfing has already applied a short-term plan (mild inexperienced) as a direct motion post-prototype and plans to implement mid-term and long-term actions (darkish inexperienced) sooner or later.

DB EngineNode KindConfigurationsRadius req/secRadius Filtering req/secClustering req/secSq. req/secMonth-to-month Prices $Value Profit %Efficiency Achieve %
Elasticsearch 7.1m4.10xlarge x45 shards2841580224129584,6400
Amazon OpenSearch Service 1.0r6g.2xlarge x2

1 shard


Amazon OpenSearch Service 1.0r6g.2xlarge x21 shard199312681256851078,5688,755,6
Aurora PostgreSQL 13.4r6g.2xlarge x2PostGIS0027535531031,0489,24782,03

100 WCU

500 RCU


The next diagram illustrates the up to date structure.


Plugsurfing was capable of obtain a 70% price discount over their legacy setup with two-times higher efficiency through the use of purpose-built databases like DynamoDB, Aurora PostgreSQL, and AWS Graviton primarily based situations for Amazon OpenSearch Service. They achieved the next outcomes:

  • The radius search and radius search with filtering use circumstances achieved higher efficiency utilizing Amazon OpenSearch Service on AWS Graviton with a denormalized doc construction
  • The sq. search use case carried out higher utilizing Aurora PostgreSQL, the place we used the PostGIS extension for geo sq. queries
  • The geo clustering search use case carried out higher utilizing DynamoDB

Study extra about AWS Graviton situations and purpose-built databases on AWS, and tell us how we might help optimize your workload on AWS.

In regards to the Creator

Anand ShahAnand Shah is a Huge Information Prototyping Resolution Architect at AWS. He works with AWS prospects and their engineering groups to construct prototypes utilizing AWS Analytics providers and purpose-built databases. Anand helps prospects remedy essentially the most difficult issues utilizing art-of-the-possible expertise. He enjoys seashores in his leisure time.



Please enter your comment!
Please enter your name here

Most Popular