aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: e3a6409e2f9a812d206758b674a552881d92acad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Goxy -- a go (reverse) proxy

## Goals

- Listen for HTTP and HTTPS on public IP
- Terminate SSL (SNI)
- HTTP/2.0 out of the box
- Proxy to backends (HTTP/1.1, wsgi, fcgi?)
- Zero downtime (re-)configuration
- Redirect HTTP to HTTPS

## Configuration unit

- Hostname(s)
- Upstream(s) (Round-robin if many)
- Optional TLS Certificate and Key

## Testing

    ab -n 10000 -c 1000 -H 'Host: gowiki.moccu' http://127.0.0.1/view/Home

Concurrency Level:      1000
Time taken for tests:   1.694 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      18130000 bytes
HTML transferred:       16950000 bytes
Requests per second:    5902.56 [#/sec] (mean)
Time per request:       169.418 [ms] (mean)
Time per request:       0.169 [ms] (mean, across all concurrent requests)
Transfer rate:          10450.54 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   17 120.9      0    1001
Processing:     1   94  98.1     64    1009
Waiting:        1   93  98.1     64    1009
Total:          1  111 152.9     67    1132

    ab -n 10000 -c 1000 http://gowiki.moccu/view/Home

Concurrency Level:      1000
Time taken for tests:   1.590 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      18130000 bytes
HTML transferred:       16950000 bytes
Requests per second:    6291.16 [#/sec] (mean)
Time per request:       158.953 [ms] (mean)
Time per request:       0.159 [ms] (mean, across all concurrent requests)
Transfer rate:          11138.54 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   52 214.2      1    1005
Processing:     0   48  53.8     33     427
Waiting:        0   48  53.6     33     427
Total:          1  100 223.2     37    1424

## Build'n'Run

    docker build -t goxy .
    docker run -d --name goxy -p 192.168.243.5:80:80 -p 192.168.243.5:443:443 --net testnet goxy

## Debug links

- http://goxy.moccu:8080/debug/route
- http://goxy.moccu:8080/debug/pprof
- http://goxy.moccu:8080/debug/rpc

## TODO

- rewrite for 2 (3?) independend mappings (http, https, ws, wss)
- improve testing

### Mapping

#### Host scheme
    http://host/path -> http only
    https://host/path -> http redirect to https, cert required
    ws, wss -- ?

#### Upstream scheme
    http://backend/path
    https://backend/path
    ws://backend/path
    wss://backend/path