All Projects → edwardyoon → Heimdallr

edwardyoon / Heimdallr

Licence: apache-2.0
Heimdallr, a Large-scale chat application server based on Redis Pubsub and Akka's actor model.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Heimdallr

Chat.io
A Real Time Chat Application built using Node.js, Express, Mongoose, Socket.io, Passport, & Redis.
Stars: ✭ 1,325 (+3386.84%)
Mutual labels:  chat, real-time
Hydra
A real-time data replication platform that "unbundles" the receiving, transforming, and transport of data streams.
Stars: ✭ 68 (+78.95%)
Mutual labels:  akka, real-time
Gophergameserver
🏆 Feature packed, easy-to-use game server API for Go back-ends and Javascript clients. Tutorials and examples included!
Stars: ✭ 61 (+60.53%)
Mutual labels:  chat, real-time
Cookim
Distributed web chat application base websocket built on akka.
Stars: ✭ 198 (+421.05%)
Mutual labels:  akka, chat
Sketch Chat
A Sketch plugin to chat in Sketch Cloud files
Stars: ✭ 20 (-47.37%)
Mutual labels:  chat, real-time
Rocket.chat
The communications platform that puts data protection first.
Stars: ✭ 31,251 (+82139.47%)
Mutual labels:  chat, real-time
Applozic Ios Sdk
iOS Real Time Chat & Messaging SDK
Stars: ✭ 104 (+173.68%)
Mutual labels:  chat, real-time
Workbase Server
Slack alternative, email integrated, build with Meteor
Stars: ✭ 284 (+647.37%)
Mutual labels:  chat, real-time
Applozic Android Sdk
Android Real Time Chat & Messaging SDK
Stars: ✭ 611 (+1507.89%)
Mutual labels:  chat, real-time
Chatify
A Laravel package that allows you to add a complete user messaging system into your new/existing Laravel application.
Stars: ✭ 885 (+2228.95%)
Mutual labels:  chat, real-time
Mangosta Ios
MongooseIM client for iOS
Stars: ✭ 28 (-26.32%)
Mutual labels:  chat, real-time
Prettyos
A Preemptive Hard Real Time kernel for embedded devices.
Stars: ✭ 36 (-5.26%)
Mutual labels:  real-time
Profanity
Ncurses based XMPP client
Stars: ✭ 966 (+2442.11%)
Mutual labels:  chat
Constructr Consul
This library enables to use Consul as cluster coordinator in a ConstructR based node
Stars: ✭ 32 (-15.79%)
Mutual labels:  akka
Freertos Cell
FreeRTOS for Jailhouse Cells
Stars: ✭ 31 (-18.42%)
Mutual labels:  real-time
Toketi Iothubreact
Akka Stream library for Azure IoT Hub
Stars: ✭ 36 (-5.26%)
Mutual labels:  akka
Rtb
Benchmarking tool to stress real-time protocols
Stars: ✭ 35 (-7.89%)
Mutual labels:  real-time
Lightweight Human Pose Estimation.pytorch
Fast and accurate human pose estimation in PyTorch. Contains implementation of "Real-time 2D Multi-Person Pose Estimation on CPU: Lightweight OpenPose" paper.
Stars: ✭ 958 (+2421.05%)
Mutual labels:  real-time
Awesome Autonomous Driving Papers
This repository provides awesome research papers for autonomous driving perception. If you do find a problem or have any suggestions, please raise this as an issue or make a pull request with information (format of the repo): Research paper title, datasets, metrics, objects, source code, publisher, and year.
Stars: ✭ 30 (-21.05%)
Mutual labels:  real-time
Q Municate Services Ios
Easy-to-use services for Quickblox SDK, for speeding up development of iOS chat applications
Stars: ✭ 30 (-21.05%)
Mutual labels:  chat

Heimdallr

Heimdallr is a large-scale chat application server inspired by the LINE+ chatting service architecture and written in Scala language based on Akka's actor model. It provides fault-tolerant and reliable scaling-out options, based on Redis Pubsub to support expansion from proof-of-concept to enterprise-ready solutions. It has been tested to be at least 100x faster than socket.io for large-scale systems. Heimdallr is currently powered by real-world production and supporting heavy simultaneous connections. This project is licensed under the Apache License v2.0.

Architecture

Heimdallr’s architecture consists of a Akka HTTP Server, Streams and ChatRoomActor, UserActor, AggregationActor. Each ChatRoom can be distributed across multiple servers. To synchronize the messages among servers, we uses Redis PubSub. UserActor is created per every websocket client.

Supervisor Hierarchies

TODO: not implemented yet.

Comparison w/ Node.js and Socket.io

The HTTP server test below was done using the wrk benchmarking tool with 6 threads and 10000 connections on a single m4.large instance.

Node.js Heimdallr
Requests per sec 14533.90 20675.89
Avg. Latency 68.94 ms 13.35 ms
Summary 873389 requests in 1.00m, 108.36MB read
Socket errors: connect 8981, read 0, write 0, timeout 0
Requests/sec: 14533.90
Transfer/sec: 1.80MB
1242244 requests in 1.00m, 181.26MB read
Socket errors: connect 8981, read 0, write 0, timeout 0
Requests/sec: 20675.89
Transfer/sec: 3.02MB

This table shows the performance of event broadcasting, the average latency for a message to arrive at a websocket client. This test was done on the same m4.large instance as the HTTP server test.

Socket.io
(single node)
Heimdallr
(single node)
Heimdallr Cluster
(2 nodes)
Heimdallr Cluster
(4 nodes)
10 sub, 1 pub 43 ms 43 ms 16 ms 20 ms
100 sub, 5 pub 62 ms 61 ms 53 ms 32 ms
1000 sub, 10 pub 496 ms 390 ms 129 ms 47 ms
1000 sub, 50 pub 1304 ms 554 ms 141 ms 109 ms
1000 sub, 100 pub 2242 ms 605 ms 202 ms 114 ms

Getting Started

Clone the repository and try to build with sbt:

% sbt run

To setup a websocket load balancer, you can use HAProxy or Apache2 HTTPD with proxy modules. If you need to support heavy concurrency, AWS ALB or HAProxy is recommended. If you want to use Apache2, enable modules with the following command: sudo a2enmod rewrite proxy proxy_http proxy_wstunnel proxy_balancer lbmethod_byrequests

And edit the virtual host file like below:

<VirtualHost *:80>
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule proxy_module>
                RewriteEngine On
                RewriteCond %{REQUEST_URI} !^/
                RewriteRule ^(.*)$ /$1 [P]

                ProxyRequests Off
                ProxyPass "/" balancer://mycluster/

                <Proxy "balancer://mycluster">
                        BalancerMember ws://{HEIMDALLR_SERVER_ADDRESS_1}:8080
                        BalancerMember ws://{HEIMDALLR_SERVER_ADDRESS_2}:8080
                </Proxy>
        </IfModule>
</VirtualHost>

To enable the Redis PubSub, open the application.conf file and edit the Redis IP address and port like below:

redis-ip = "{REDIS_IP_ADDRESS}" and redis-port = 6379

Java Websocket Client Example

In this example, Java-WebSocket library was used.

public class WSClientSample extends WebSocketClient {

  public WSClientSample(URI serverURI) {
    super(serverURI);
  }
  ...
  
  public static void main(String[] args) throws Exception {
    String uri = ("ws://APACHE_WEBSERVERR/{CHATROOMID}");
    WSClientSample c = new WSClientSample(new URI(uri));
    c.connect();
  }
}

Client Demo HTML example

To see demo of our project, you can use our ready-made websocket connected html file in Heimdallr/src/main/web.

Development pattern for contributors

Basically follow the Scala style guide.

  1. Fork heimdallr repository into your GitHub.
  2. Create a branch for the feature and modify the code.
  3. Please pull request the branch you worked on.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].