Skip to content

Commit

Permalink
Openshift: move dnsmasq to another container in apicast pod.
Browse files Browse the repository at this point in the history
DNSmasq process was not handled by Apicast at all, dnsmasq process can die and
will never be up, so dns queries will start to fail.

This commit changed the DNS service to another container into the apicast pod
and Openshift will take care that the process is always up.

About the performance, tested in minishift:

With two containers:

```
✗ oc exec -ti apicast-client -- wrk -d 100 -c 100 -t 20  -H "Host: one" http://172.30.136.10:8080/\?user_key\=123
Running 2m test @ http://172.30.136.10:8080/?user_key=123
  20 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    81.62ms   31.71ms 339.01ms   82.13%
    Req/Sec    62.66     21.25   137.00     67.09%
  124294 requests in 1.67m, 16.71MB read
Requests/sec:   1241.75
Transfer/sec:    170.92KB
```

With one container:
```
✗ oc exec -ti apicast-client -- wrk -d 100 -c 100 -t 20  -H "Host: one" http://172.30.136.20:8080/\?user_key\=123
Running 2m test @ http://172.30.136.20:8080/?user_key=123
  20 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   100.75ms   46.53ms 501.73ms   81.52%
    Req/Sec    51.57     21.33   150.00     63.64%
  101442 requests in 1.67m, 13.64MB read
Requests/sec:   1013.35
Transfer/sec:    139.49KB
```

Fix THREESCALE-1555

Signed-off-by: Eloy Coto <[email protected]>
  • Loading branch information
eloycoto committed Jul 12, 2019
1 parent 5df6144 commit 2781e03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Extended variables in Liquid template operations [PR #1081](https://github.com/3scale/APIcast/pull/1081)
- Introduce possibility of specifying policy order restrictions in their schemas. APIcast now shows a warning when those restrictions are not respected [#1088](https://github.com/3scale/APIcast/pull/1088), [THREESCALE-2896](https://issues.jboss.org/browse/THREESCALE-2896)
- Using another container for dnsmasq on Openshift [PR #1090](https://github.com/3scale/APIcast/pull/1090), [THREESCALE-1555](https://issues.jboss.org/browse/THREESCALE-1555)

## [3.6.0-beta1] - 2019-06-18

Expand Down
8 changes: 0 additions & 8 deletions gateway/.s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,4 @@ else
apicast=apicast
fi

dnsmasq --listen-address=127.0.0.1 --port=5353 \
--all-servers --no-host --no-hosts \
--cache-size=1000 --no-negcache --domain-needed \
--server="${RESOLVER:-}" \
--log-facility=- ${DNSMASQ_OPTIONS:-} \

export RESOLVER=127.0.0.1:5353

exec "${apicast}" "$@"
19 changes: 19 additions & 0 deletions openshift/apicast-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ objects:
- name: management
containerPort: 8090
protocol: TCP
- name: dns
image: "{IMAGE_NAME}"
imagePullPolicy: Always
ports:
- name: dns
port: 5353
containerPort: 5353
command: [ "dnsmasq" ]
args:
- "-d"
- "--log-queries"
- "--listen-address=127.0.0.1"
- "--port=5353"
- "--all-servers"
- "--no-host"
- "--no-hosts"
- "--cache-size=1000"
- "--no-negcache"
- "--domain-needed"
triggers:
- type: ConfigChange

Expand Down

0 comments on commit 2781e03

Please sign in to comment.