Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

yvt/Merlion

Repository files navigation

Merlion: Real-time Network Application Server

Merlion is an application server for .NET-based real-time network applications with an integrated load balancer.

What is it?

Merlion is designed to handle heavy-load .NET network applications with many simultaneous connections by distributing the workload across several node servers.

Merlion also provides an easy deployment of the application via the integrated web console. Deployment and upgrade of the application can be done with no down time. Running more than two versions at once is even possible to evaluate the newly created version before it gets ready for public use.

Following diagram shows an example configuration of Merlion servers.

         +------------------------+  +------------------------+     
         |                        |  |                        |     
         | +---------------+      |  | +---------------+      |     
         | | Version Alpha <--+   |  | | Version Alpha <--+   |     
         | +---------------+  |   |  | +---------------+  |   |     
         |                    |   |  |                    |   |     
         | +---------------+  |   |  | +---------------+  |   |     
         | | Version Beta  <--+   |  | | Version Beta  <--+   |     
         | +---------------+  |   |  | +---------------+  |   |  ...
Nodes    |                    |   |  |                    |   |     
         | +------------------+-+ |  | +------------------+-+ |     
         | |                    | |  | |                    | |     
         | |    Merlion Node    | |  | |    Merlion Node    | |     
         | |                    | |  | |                    | |     
         | +---------^----------+ |  | +---------^----------+ |     
         |           |            |  |           |            |     
         +------------------------+  +------------------------+     
                     |                           |                  
                     +-------+          +--------+                  
                             |          |                           
                   +-------------------------------+                
                   |         |          |          |                
                   |  +------v----------v-------+  |                
                   |  |                         |  |                
Master             |  |  Merlion Master Server  |  |                
                   |  |                         |  |                
                   |  +------------^------------+  |                
                   |               |               |                
                   +-------------------------------+                
                                   |                                
                                   | TLS                            
                                   |                                
                                   v                                
                           So many clients...   

Key Elements

  • Master server accepts connection from clients, binds each of them to a domain, and makes a bridge between the client and the domain. Master server also manages the lifetime of application versions and associated application domains. Master server owns its own node server called "Local", therefore Merlion can be used on single server configuration before scaling out the server cluster.
  • Node server is where the application actually run. It creates application domains on which each version of the application is deployed.
  • Application domain is an isolated environment where a certain version of the Merlion application runs.
  • Application version is a package of Merlion application. Each version is stored in the master server as a zip file, and transferred to node servers and extracted as needed. Each version has a name.
  • Room is a kind of token which is created by the application as needed and can be used by clients to connect to the certain application domain later.

Screenshots

Web Console Web Console

Test Server

When debugging the Merlion application, a complete server stack might be too bulky. So we included a testing server called MerlionSimpleServer which only supports one application domain and one application version.

Using MerlionSimpleServer for production use is not recommended.

Requirements

  • Currently, only Linux and OS X 10.9 Maverics are supported.
  • Mono 3.2.8 or later is required.
  • OpenSSL is required.
  • Boost 1.55.0 or later which was built with the C++ compiler you are going to build MerlionServerCore with.
  • ISO/IEC 14882:2011 (a.k.a. C++11) compliant compiler. Clang is recommended (#1).

Building

  1. Run cmake . in MerlionServerCore. Using Clang instead of GCC is recommended. To instruct CMake to use Clang, pass -DCMAKE_CXX_COMPILER=/usr/bin/clang++ to CMake.
  2. Build MerlionServerCore by running make.
  3. Run nuget restore in the source root to download required libraries.
  4. Build .NET solution by running xbuild in the source root.
  5. Copy (or make a symbolic link) MerlionServerCore/libMerlionServerCore.so to MerlionServer/bin/Debug/libMerlionServerCore.so.

Configuring Server

Merlion server uses the configuration file "MerlionServer.exe.config" which must be placed at the same location as the executable file (MerlionServer.exe).

Master

  • EndpointAddress
  • MasterServerAddress is the address where the master server listens for nodes at.
  • MasterServerCertificate is the certificate file used during TLS handshake.
  • MasterServerPrivateKey is the private key file of MasterServerCertificate.
  • If DisallowClientSideVersionSpecification is set to True, client cannot specify the application version name.
  • WebInterfaceAddress is the address of the web console.

TODO

Node

  • NodeName is the node's name. Preferred to keep it unique.
  • When ForwardLogToMaster is set to True, log messages recorded by the node server are also forwarded to the master server, and are displayed in the web console.

TODO

Creating Application

Please take a look at an example application MerEcho.

TODO

About

Dynamically configurable load balancer with .NET realtime network application server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published