All Projects → dgrr → http2

dgrr / http2

Licence: Apache-2.0 License
HTTP/2 implementation for fasthttp

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to http2

Http2Pusher
PHP Http2 Server Push
Stars: ✭ 27 (-75%)
Mutual labels:  http2
HAProxy-2-RPM-builder
Build latest HAProxy binary with prometheus metrics support
Stars: ✭ 28 (-74.07%)
Mutual labels:  http2
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-83.33%)
Mutual labels:  http2
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (-70.37%)
Mutual labels:  http2
fs-over-http
A filesystem interface over http, with extras and docker support
Stars: ✭ 14 (-87.04%)
Mutual labels:  fasthttp
node-apn-http2
Communicate with Apple Push Notification Service via native Node.js v8.8.1+ HTTP2 module (node-apn drop-in)
Stars: ✭ 25 (-76.85%)
Mutual labels:  http2
http-protocol
HTTP协议原理分享
Stars: ✭ 123 (+13.89%)
Mutual labels:  http2
kamasu
HTTP/HTTPS/HTTP2 Proxy for PHP Built-in Server, written in Rust
Stars: ✭ 14 (-87.04%)
Mutual labels:  http2
summary1
个人总结 持续更新 欢迎提出各种issues
Stars: ✭ 13 (-87.96%)
Mutual labels:  http2
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 8,395 (+7673.15%)
Mutual labels:  http2
rester
Fast and concise RESTful web framework based on fasthttp
Stars: ✭ 27 (-75%)
Mutual labels:  fasthttp
gmocker
Create a blazing fast mock server with just a JSON file
Stars: ✭ 49 (-54.63%)
Mutual labels:  fasthttp
MongoosePush
MongoosePush is a simple Elixir RESTful service allowing to send push notification via FCM and/or APNS.
Stars: ✭ 101 (-6.48%)
Mutual labels:  http2
http bench
golang HTTP stress test tool, support single and distributed
Stars: ✭ 142 (+31.48%)
Mutual labels:  http2
kwerri-oss
Kwerri OSS: samvloeberghs.be + jsonld + seo service + scully-plugin-minify-html + scully-plugin-disable-angular
Stars: ✭ 60 (-44.44%)
Mutual labels:  http2
light-rest-4j
A RESTful framework built on top of light-4j with both Swagger 2.0 and OpenAPI 3.0 supports
Stars: ✭ 113 (+4.63%)
Mutual labels:  http2
fasthttpcors
Cors Handler for fasthttp
Stars: ✭ 20 (-81.48%)
Mutual labels:  fasthttp
EdgeAdmin
CDN & WAF集群管理系统。
Stars: ✭ 199 (+84.26%)
Mutual labels:  http2
static-web-server
A blazing fast and asynchronous web server for static files-serving. ⚡
Stars: ✭ 230 (+112.96%)
Mutual labels:  http2
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 154 (+42.59%)
Mutual labels:  http2

HTTP2

http2 is an implementation of HTTP/2 protocol for fasthttp.

Download

go get github.com/dgrr/[email protected]

Help

If you need any help to set up, contributing or understanding this repo, you can contact me on gofiber's Discord.

How to use the server?

The server can only be used if your server supports TLS. Then, you can call ConfigureServer.

package main

import (
	"github.com/valyala/fasthttp"
	"github.com/dgrr/http2"
)

func main() {
    s := &fasthttp.Server{
        Handler: yourHandler,
        Name:    "HTTP2 test",
    }

    http2.ConfigureServer(s, http2.ServerConfig{})
    
    s.ListenAndServeTLS(...)
}

How to use the client?

The HTTP/2 client only works with the HostClient.

package main

import (
        "fmt"
        "log"

        "github.com/dgrr/http2"
        "github.com/valyala/fasthttp"
)

func main() {
        hc := &fasthttp.HostClient{
                Addr:  "api.binance.com:443",
        }

        if err := http2.ConfigureClient(hc, http2.ClientOpts{}); err != nil {
                log.Printf("%s doesn't support http/2\n", hc.Addr)
        }

        statusCode, body, err := hc.Get(nil, "https://api.binance.com/api/v3/time")
        if err != nil {
                log.Fatalln(err)
        }

        fmt.Printf("%d: %s\n", statusCode, body)
}

Benchmarks

Benchmark code here.

fasthttp2

$  h2load --duration=10 -c10 -m1000 -t 4 https://localhost:8443
[...]
finished in 10.01s, 533808.90 req/s, 33.09MB/s
requests: 5338089 total, 5348089 started, 5338089 done, 5338089 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 5338089 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 330.90MB (346976335) total, 137.45MB (144128403) headers (space savings 57.14%), 101.82MB (106761780) data
                     min         max         mean         sd        +/- sd
time for request:     1.06ms    101.25ms     17.16ms     11.06ms    75.19%
time for connect:     5.21ms     17.36ms     12.60ms      3.56ms    70.00%
time to 1st byte:    11.32ms     35.27ms     18.84ms      6.85ms    80.00%
req/s           :   48976.50    59084.92    53359.02     3657.52    60.00%

net/http2

$  h2load --duration=10 -c10 -m1000 -t 4 https://localhost:8443
[...]
finished in 10.01s, 124812.90 req/s, 5.00MB/s
requests: 1248129 total, 1258129 started, 1248129 done, 1248129 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1248247 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 50.00MB (52426258) total, 4.76MB (4995738) headers (space savings 95.83%), 23.81MB (24962580) data
                     min         max         mean         sd        +/- sd
time for request:      141us    140.75ms     19.69ms     11.34ms    76.79%
time for connect:     3.89ms     13.30ms      9.71ms      2.78ms    70.00%
time to 1st byte:    11.02ms     50.13ms     20.13ms     11.24ms    90.00%
req/s           :   11909.97    13162.89    12479.53      373.71    70.00%
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].