• This repository has been archived on 31/Mar/2022
  • Stars
    star
    1,506
  • Rank 31,140 (Top 0.7 %)
  • Language
    Scala
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⚡ High performance websocket servers implemented by Spray-can, Netty, undertow, jetty, Vert.x, Grizzly, node.js and Go. It supports 1,200,000 active websocket connections

This project provides eight high performance websocket server implementation and can be used to test their benchmark.

The eight high performance websocket servers contain:

I have test them and wrote two posts about test results in Chinese:

七种WebSocket框架的性能比较 使用四种框架分别实现百万websocket常连接的服务器

The test result shows Netty, Go, Node.js, Undertow, Vert.x can setup 1 million connections. Netty and Go is best.

You can test them and update the test result by submitting an issue or create a pull request.

Compile

I wrote those websocket implementation in Scala, Go and Node.js. The code is simple but they are a basic websocket server prototype. You can use them as a scaffold to develop chat, message pushing, notifications systems, etc.

You can run sbt task to create distributions for scala projects (netty, grizzly, jetty,spray,undertow,vert.x, testclient).

sbt clean dist

For goserver and go-fasthttp, you can run the "install" script to build the server.

Node.js is a javascript file.

Deploy

For scala projects, you can copy target/universal/xxxxxx.zip to your server and unzip it. The unzipped directory contains start script (at bin directory), configuration files (at conf directory) and libraries (at lib directory).

For Go projects, copy compiled binary file and config.json to your server.

For node.js, copy scripts and dependencies modules to your server.

Configuration

One server can't support benchmark test for one million websocket connections. There servers are recommended, for example, there AWS C3.8xlarge servers or better.

One server is used for a websocket server and two servers are for clients.

echo 2000000 > /proc/sys/fs/nr_open
echo 2000000 > /proc/sys/fs/file-max
ulimit -n 2000000

Modify /etc/sysctl.conf and add:

net.ipv4.ip_local_port_range = 1024  65000

and for Java, set memory options:

export JAVA_OPTS="-Xms12G -Xmx12G -Xss1M -XX:+UseParallelGC"

for node.js/V8:

node --nouse-idle-notification --expose-gc --max-new-space-size=1024 --max-new-space-size=2048 --max-old-space-size=8192 ./webserver.js

because one client/one IP only setup about 60,000 connections so you need set up more test IP, for example:

ifconfig eth0:1 192.168.77.11 netmask 255.255.255.0 up
ifconfig eth0:2 192.168.77.12 netmask 255.255.255.0 up
ifconfig eth0:3 192.168.77.13 netmask 255.255.255.0 up
……
ifconfig eth0:19 192.168.77.29 netmask 255.255.255.0 up
ifconfig eth0:20 192.168.77.30 netmask 255.255.255.0 up

Servers will send one message per minutes to all 1,200,000 connections. Each message only contains current time of this server. Clients can output metrics to monitor.

You can adjust those parameters in application.conf. Please refer to reference.conf.

For example, Netty uses the below parameters:

server.port = 8088
sending.timer.delay = 10 minutes
sending.timer.interval = 1 minutes
totalSize = 1200000
onlyTestConnect = true

It will send the first message after 10 minutes and will send messages per minute since then. But if connections has not reached 1,200,000, it won't send messages to active connections. onlyTestConnect is true means server won't send message and we only test websocket setup.

For testclient, you can adjust those below parameters:

local.ip = "0.0.0.0"
server.uri = "ws://localhost:8088"
setup.batchSize = 500
setup.interval = 1000
total.clients = 50000
websocket.timeout = 0
setup.threadpool.size = 1

You can change local.ip to multiple ip:

local.ip = "192.168.77.11,192.168.77.12,192.168.77.13,192.168.77.14,192.168.77.15,192.168.77.16,192.168.77.17,192.168.77.18,192.168.77.19,192.168.77.20,192.168.77.21,192.168.77.22,192.168.77.23,192.168.77.24,192.168.77.25,192.168.77.26,192.168.77.27,192.168.77.28,192.168.77.29,192.168.77.30"

and server uri:

server.uri = "ws://192.168.77.10:8088"

total.clients is max count of clients per IP.

More Repositories

1

rpcx

Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱! build for cloud!
Go
7,712
star
2

go-web-framework-benchmark

⚡ Go web framework benchmark
Go
1,915
star
3

1m-go-tcp-server

benchmarks for implementation of servers which support 1 million connections
Go
1,840
star
4

dive-to-gosync-workshop

深入Go并发编程研讨课
Go
1,618
star
5

gen

Converts a database into gorm structs and RESTful api
Go
1,428
star
6

concurrency-programming-via-rust

Rust
1,296
star
7

chanx

unbounded chan
Go
425
star
8

ringbuffer

a thread-safe circular buffer (ring buffer) in Go, implemented io.ReaderWriter interface
Go
412
star
9

gosercomp

⚡ Golang Serializer Benchmark Comparison
Go
403
star
10

gofsm

a featured FSM that can export state images
Go
297
star
11

go-best-practices

resources for go best practices
289
star
12

douban-recommender

基于Spark ML实现的豆瓣电影推荐系统
Scala
224
star
13

rpcx-ui

rpcx manager web ui
Go
215
star
14

gotips

Go tips from Phuong Le. Go语言编程技巧
189
star
15

Jax-RS-Performance-Comparison

⚡ Performance Comparison of Jax-RS implementations and embedded containers
Java
187
star
16

weighted

high-performance common weighted algorithm library
Go
185
star
17

ZKRecipesByExample

all examples for ZooKeeper recipes by Curator
Java
183
star
18

go-concurrent-quiz

Go concurrency quizzes
Go
170
star
19

goframe

send/receive framed data via TCP or QUIC
Go
167
star
20

kafka-example-in-scala

a kafka producer and consumer example in scala and java
Java
152
star
21

ebooks

制作的电子书越来越多,找个仓库放置,方便下载
149
star
22

rpcx-programming-guide-cn

gitbook Go RPC开发指南 [中文文档]
CSS
142
star
23

glean

hotfix for go applications via plugin, supports Linux and MacOS
Go
130
star
24

rpcx-rs

rpcx microservice framework in Rust
Rust
126
star
25

queue

lock-free queue and other implementations
Go
126
star
26

goreq

A Simplified Golang Http Client
Go
104
star
27

go_test_workshop

Go Test Workshop
HTML
100
star
28

gofer

Go
95
star
29

channels

go channel patterns
Go
89
star
30

resp3

First redis RESP3 protocol library in Go
Go
85
star
31

smallchat

A minimal programming example for a chat server in Go and Rust
Rust
81
star
32

epoller

epoll implementation for connections in Linux, MacOS and Windows
C
80
star
33

rpcx-java

rpcx implementation in Java for server side and client side
Java
79
star
34

grpc-examples

examples for gRPC
Go
63
star
35

exp

Experimental packages not in std and golang.org/exp
Go
63
star
36

distributed

distributed synchronization primitives
Go
60
star
37

leetcode-solutions

leetcode 算法题解精选
46
star
38

FlyRunner

一个记录你地图路线的跑步软件,无需google map支持
Java
44
star
39

rpcxdump

a tcpdump-like tool to capture rpcx tcp packets
Go
43
star
40

hash-bench

go hash benchmark
Go
41
star
41

zhuge

救命用的profile
Go
41
star
42

mping

a multi-targets ping tool, which supports 10,000 packets/second, accurate latency
Go
40
star
43

spring-kafka-demo

Java
37
star
44

Tractor

A Tractor game. (升级,一个在中国非常流行的扑克牌游戏。又叫拖拉机,双扣)。 Developed by C#
C#
37
star
45

network_benchmark

3百万QPS benchmark测试
Go
34
star
46

mping-rs

a multi-targets ping tool and library, which supports 10,000 packets/second, accurate latency
Rust
34
star
47

mahout-douban-recommender

基于mahout实现的豆瓣电影推荐系统
Java
33
star
48

RPC-TEST

test performance of gRPC and Thrift. All services are implemented as HelloWorld by Java, Scala and Golang
Shell
30
star
49

breakdown

记录国内外互联网公司和电信企业P0级别的重大故障
28
star
50

quick

an encrypted UDP connection between two peers using QUIC
Go
26
star
51

talk-about-go-generics

谈谈Go泛型 - GopherChina 2023 大会分享
Go
25
star
52

concurrency-programming-via-go-code

code of concurrency programming via go
Go
25
star
53

pping-go

使用Go语言实现pping
Go
19
star
54

gitalk

gitalk for colobu
19
star
55

fastjson-jaxrs-json-provider

a JAX-RS entity provider for https://github.com/alibaba/fastjson
Java
18
star
56

redis-bench

a different redis bench tool that is used for test latency at given max throughputs
Go
16
star
57

iprange

check whether a IP is in IP ranges with CIDR format such as 216.249.16.0/20 and 2a01:5a80::/32
Go
16
star
58

rpcxlite

a lite version of rpcx
Go
16
star
59

smallnest.github.io

HTML
16
star
60

leetcode

有空就刷题
Go
14
star
61

syncx

more advanced sync primitives in Go
Go
14
star
62

kafka_monitor

A kafka monitor to send alarm emails
Go
14
star
63

rediscopy

copy redis requests to other servers
Go
14
star
64

weighted-rs

A Rust library for weighted balancing algorithm
Rust
12
star
65

gomemcached

memcached protocol implementation for memcached server
Go
12
star
66

slog-exp

slog experimental features
Go
11
star
67

rpcx-agent

Agent to invoke rpcx services in C++, Java, Python, C#, Ruby, etc. for rpcx 2.x
Go
10
star
68

gofu

functional go with generic types
10
star
69

libra-wallet

a libra wallet example in go
HTML
9
star
70

qianmo

additional network functions
Go
9
star
71

rust-examples

study rust by examples
Rust
9
star
72

rpcx-programming-guide-en

rpcx programming guide (english version)
9
star
73

Ember-Lance

Dashboard Bootstrap implemented with sb-admin2, Ember, D3.js and other third-party libraries
JavaScript
9
star
74

DisruptorBootstrap

Example for Disruptor and Spring Reactor
Java
8
star
75

nettrace.bak

explore internal/nettrace in go std lib
Go
8
star
76

go-app-metrics

add system monitor (cpu/load/memory/disk/bandwidth) to go-metrics
Go
7
star
77

blockchain

a general blockchain implementation
Go
7
star
78

go-cheatsheets

7
star
79

go-generics-examples

go generics examples
Assembly
7
star
80

preallocate

File preallocation library, cloned from https://git.sr.ht/~tslocum/preallocate
Go
6
star
81

pool

a go pool that you don't worry about GC
Go
5
star
82

libp2p

a secure go p2p libary, easy to use. cloned from go-spacemesh
Go
5
star
83

libkv-etcdv3-store

libkv etcd store by client v3 API: https://github.com/docker/libkv
Go
5
star
84

benchpi

rust examples for calculating PI
Rust
4
star
85

json-parser-benchmark

json parser benchmark
Go
4
star
86

Java-Memcached-Clients-Benchmark

⚡ Benchmark for Java Memcached clients such as SpyMemcached, XMemcached and folsom
Scala
4
star
87

p2p

p2p examples
Go
4
star
88

word

一个命令行中查找英语单词的意思和发音
Go
4
star
89

kafka-go-examples

examples for kafka go clients
Go
3
star
90

golang-tls

golang tls for http/http2 examples
Go
3
star
91

tracert

a special traceroute lib for multiple paths by UDP
Go
3
star
92

awesome-web-templates

record free web templates
3
star
93

concurrency-programming-via-go

Go并发编程勘误页和问题反馈
2
star
94

Scala-Collections-Cookbook

codes for the book "Scala Collections Cookbook"
Scala
2
star
95

libra-wallet-rust

libra wallet in rust
CSS
2
star
96

batch

batch process or timeout
Go
2
star
97

shorturl

a scalable high performance ShortURL server
Scala
2
star
98

go-database-study

study golang database lib
Go
2
star
99

bitcoin

bitcoin study
Go
2
star
100

ai_assistant

熊厂内分享,github copilot vs baidu comate
Go
1
star