C C++ Go Other
Switch branches/tags
Nothing to show
Clone or download
hodduc Delete QuicConnection when simpleServerSession is cleaned up
 (From Chrome 55, abstract class (QuicSession) does not owns
  QuicConnection anymore.)
Latest commit 1e49c0f Jun 27, 2017
Permalink
Failed to load latest commit information.
boringssl/openssl boringssl update May 4, 2016
example Fix example server Sep 21, 2016
libquic @ 8954789 Fix broken libquic build for linux/freebsd Sep 21, 2016
src Delete QuicConnection when simpleServerSession is cleaned up Jun 27, 2017
vendor Add missing vendor Aug 23, 2016
.dockerignore Update dockerignore Jul 11, 2016
.gitignore Add libquic as submodule Jul 11, 2016
.gitmodules Add libquic as submodule Jul 11, 2016
AUTHORS Added myself to AUTHORS Jul 21, 2015
Dockerfile Update dockerfile to 1.7 and introduce vendor/ Aug 23, 2016
LICENSE Update AUTHORS and LICENSE Mar 16, 2015
Makefile apply libquic changes (55.0.2861.0) Sep 21, 2016
README.md Update README.md Jul 11, 2016
alarm.go Use custom pointer holder instead of storing Go Ptr inside C memory (#19 Mar 3, 2016
bufferpool.go Implement read buffer pool Jun 17, 2016
build_libs.sh Fix Release option was not passed to make/gmake Jul 27, 2016
client.go apply libquic changes Jun 15, 2016
client_conn.go Fix RoundTripper to be more safe on concurrent situation Jan 8, 2016
client_wrapper.go libquic: v0.0.3 Mar 10, 2016
datastream_client.go Add RemoteAddr support Jun 15, 2016
datastream_server.go Add ContentLength on request. Fix body leakage on Go >= 1.8. Jun 21, 2017
dispatcher.go Optimize buffer size constants Jun 16, 2016
go_functions.c apply libquic changes (55.0.2861.0) Sep 21, 2016
go_functions.h apply libquic changes (55.0.2861.0) Sep 21, 2016
go_structs.h Some minor optimizations Jun 16, 2016
goquic.go Use SRCDIR substitution added on Go 1.5 Mar 8, 2016
init.go Use openssl/ssl.h instead of openssl/thread.h Aug 12, 2015
init_posix.go Use openssl/ssl.h instead of openssl/thread.h Aug 12, 2015
ip.go Use custom pointer holder instead of storing Go Ptr inside C memory (#19 Mar 3, 2016
proof_source.go apply libquic changes (55.0.2861.0) Sep 21, 2016
proof_verifier.go apply libquic changes (cont.) Apr 28, 2016
ptr.go MaxInt64 -> math.MaxInt64 Mar 7, 2016
ptr_gen.py MaxInt64 -> math.MaxInt64 Mar 7, 2016
quicstream_client.go Deprecate MapStrStr on client Jul 11, 2016
quicstream_server.go Some minor optimizations Jun 16, 2016
server.go QUIC 35, 36 support Aug 2, 2016
server_config.go Add missing file Apr 6, 2016
statistics.go Provide connection stat Dec 29, 2015
stream.go fix bug Aug 13, 2016
task_runner.go Fix alarm leak on exceptional case Jul 28, 2016
writer.go Implement read buffer pool Jun 17, 2016

README.md

goquic, QUIC support for Go

Docker Repository on Quay

This is a work-in-progress QUIC implementation for Go. This is based on libquic library, which is in turn based on original QUIC implementation on Chromium.

QUIC is an experimental protocol aimed at reducing web latency over that of TCP. On the surface, QUIC is very similar to TCP+TLS+SPDY implemented on UDP. Because TCP is implement in operating system kernels, and middlebox firmware, making significant changes to TCP is next to impossible. However, since QUIC is built on top of UDP, it suffers from no such limitations.

Key features of QUIC over existing TCP+TLS+SPDY include

  • Dramatically reduced connection establishment time
  • Improved congestion control
  • Multiplexing without head of line blocking
  • Forward error correction
  • Connection migration

Project Status

This library is highly experimental. Although libquic sources are from Chromium (which are tested), the Go bindings are still highly pre-alpha state.

Known issues:

  • No support for read streaming. All request must fit in memory.
  • Secure QUIC not fully tested. May not support ECDSA certificates.

Things to do:

  • Read streaming support

Preliminary Benchmarks

A very primitive benchmark testing have been done. Testing environments below:

Items Description
Optimization libquic built with -O3 parameters
CPU Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Server Code https://github.com/devsisters/goquic/blob/master/example/server.go
Server Parms GOMAXPROCS=12 ./server -port 9090 -n 12
Client Code https://github.com/devsisters/quicbench/blob/master/quicbench.go
Client Parms ./quicbench -u="https://example.com:9090/" -c 200 -r 1000

The server code is modified to create 30B, 1kB, 5kB, 10kB HTTP body payload. Concurrency is 200 and each thread requests 1,000 requests. It is designed to measure ideal throughput of the server. Naturally the throughput goes down when concurrency increases.

Benchmark results:

Payload Size Requests per Second
30B Payload 12131.25 RPS
1kB Payload 11835.13 RPS
5kB Payload 7816.21 RPS
10kB Payload 5599.73 RPS

On 10kB case, calculating the total network throughput is 458Mbps.

How many connections per second can this server process?

./gobench -u="https://example.com:9090/" -c 200 -r 100 -qk=false

Turning off keepalive using qk option results in a pure new QUIC connection per request. The benchmark results are 2905.58 CPS.

Getting Started

Get source files

go get -u -d github.com/devsisters/goquic

-u option is needed, because building (or downloading) static libraries is necessary for building and installing goquic library.

Build static library files

Although prebuilt static library files already exists in the repository for convenience, it is always good practice to build library files from source. You should not trust any unverifiable third-party binaries.

To build the library files for your architecture and OS:

./build_libs.sh (for debug build)
GOQUIC_BUILD=Release ./build_libs.sh (for release build)

This will fetch libquic master and build all the binaries from source. The C/C++ files for Go bindings will be all built too.

To build static library files, you should have cmake, C/C++ compiler, and ninja-build system (or GNU make).

Currently Linux, Mac OS X and FreeBSD is supported.

How to build

If you are using Go >= 1.5, you can build goquic binaries without any extra work.

go build $GOPATH/src/github.com/devsisters/goquic/example/server.go

If you are using Go 1.4, you should open goquic.go and manually edit ${SRCDIR} with your real path (maybe /YOUR/GOPATH/src/github.com/devsisters/goquic).

SPDY/QUIC support

We have a experimental SPDY/QUIC implementation as a library. You can use this library to add SPDY/QUIC support for your existing Go HTTP server.

See our SPDY-QUIC server/client implementation here.

How to use server

When running a HTTP server, do:

goquic.ListenAndServe(":8080", 1, nil)

instead of

http.ListenAndServe(":8080", nil)

How to use client

You need to create http.Client with Transport changed, do:

client := &http.Client{
	Transport: goquic.NewRoundTripper(false),
}
resp, err := client.Get("http://example.com/")

instead of

resp, err := http.Get("http://example.com/")