Skip to content

The Architecture Of Atlas

陈 非 edited this page Jan 20, 2015 · 3 revisions

An Overview of Atlas Architecture

Atlas is a MySQL protocol-based database middleware project. In the view of the database, Atlas is a mysql client. But in the view of mysql client, Atlas is a database server. Atlas has a connection pool for every mysql database.After finishing the client request, Atlas will give the connection back to the connection pool. The picture below depicts the overall architecture of Atlas. The Architecture Of Atlas(1)

The Architecture Of Atlas(2)

The Thread Model of Atlas

When Atlas start, it will create multiple threads.One of them is the main thread, the others are working threads. The main thread is responsible for monitoring the connecting requests from clients, and the working thread only monitor the command request from the main thread.

As shown below, The main thread recieve the request from a client, Atlas will packaging the relative information for a CON structure, and then put the CON into an asynchronous queue. The main thread chooses a working thread to process this CON by a round-robin manner, and then sends a byte to the working thread in order to activate it.When the working thread receives the activation instruction, it will take out the CON structure from the asynchronous queue, and start to process of the client request.

The Thread Mode of Atlas

Using Atlas With LVS

As shown below,The LVS in front end is for loading balance, two Atlas in the back end of LVS is for high available, preventing single point of failure.The LVS periodically detects the survival status of Atlas in two ways, one is detecting the port whether can be connected successfully. Another is executing a script, the script will try to connect to Atlas, through the value that the script returns to determine the availability of each backend.There are two running status of Atlas:online or offline.If Atlas is online, the value that the script returns online.Otherwise the value is offline.

If you want update the version of Atlas smoothly. You can follow these steps: Firstly send signal(SIGUSR2) to Atlas, then the running status of Atlas will become offline.LVS will not transpond the requests to the offline Atlas. Now you can upgrade Atlas.Secondly send signal(SIGUSR1) to Atlas to make Atlas online. LVS will detect this Atlas is online, and transpond the requests to this Atlas again.

Using Atlas With LVS