Skip to content

Scaling Sharded Database Mid Tier Routing

Bharath Ramaprasad edited this page Mar 20, 2019 · 2 revisions

Background

Mid-Tier routing services can be setup as a docker container by following the article Sharded database mid-tier routing services.

Pre-requisites

  1. Download all the Mid-tier Routing docker stack configurations files from the following location.

  2. Substitute the placeholders marked within angular brackets < > in all the docker files that expect parameters (For example : IP / port / db credentials etc..). Please refer the mid-tier routing services command usage and examples, on what to substitute for these placeholder parameter values.

Setup Mid-Tier Routing services with docker-compose

Choose one of the caching modes for mid-tier routing swim lane cache :

  • Local in-memory cache mode

In this mode, the cache is local and in-memory. So if the container goes down the swim lane details are lost. So the swim lane mappings needs to be established again.

This mode is recommended if the number of shards or the swim lane mappings aren't too large.

   > docker-compose -f sdb-mtr-local-cache.yml up
  • External REDIS cache mode

In this mode, the user is responsible here to start the REDIS instance and pass in the necessary parameters for the sdb mid-tier routing docker container. As the cache is external and running in its own container, even if the sdb-mtr container goes down, the swim lane mappings are not lost.

This mode is recommended if the number of shards or the swim lane mappings are large and you need or already using a distributed cache like REDIS.

   > docker-compose -f sdb-mtr-redis.yml up

Note : To bring down the container started with docker-compose, use the down switch with the docker-compose command to gracefully bring down the services.

Setup Mid-Tier Routing services at scale

SDB Mid-Tier routing docker stack deploy (single instance)

  > docker swarm init
  > docker stack deploy -c docker-compose.yml oracle-sdb-mtr

SDB Mid-tier routing docker stack teardown

  > docker stack rm oracle-sdb-mtr
  > docker swarm leave --force

Docker Swarm for SDB Mid-Tier routing - Local in memory cache mode

If there is a need to load balance SDB Mid-tier routing in Local in memory cache mode, then we can opt for swarm mode and specify the replication/scale factor for mid-tier routing container.

   > docker stack deploy -c sdb-mtr-local-cache-swarm-mode.yml oracle-sdb-mtr

Docker Swarm for SDB Mid-Tier routing - REDIS cache mode

If there is a need to load balance SDB Mid-tier routing in Local in memory cache mode, then we can opt for swarm mode and specify the replication/scale factor for mid-tier routing container instance.

   > docker stack deploy -c sdb-mtr-redis-swarm-mode.yml oracle-sdb-mtr