Skip to content

Commit

Permalink
Merge pull request twitter#638 from twitter/doc-updates
Browse files Browse the repository at this point in the history
Update documentation on running tests, config options, etc.
  • Loading branch information
TysonAndre authored Jul 4, 2021
2 parents 4cb2e86 + 93f3dd9 commit 0a0a1ec
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:

# Runs a single command using the runners shell
- name: Build and test in docker
run: bash ./travis.sh ${{ matrix.REDIS_VER }}
run: bash ./test_in_docker.sh ${{ matrix.REDIS_VER }}
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Twemproxy can be configured through a YAML file specified by the -c or --conf-fi
+ crc32 (crc32 implementation compatible with [libmemcached](http://libmemcached.org/))
+ crc32a (correct crc32 implementation as per the spec)
+ fnv1_64
+ fnv1a_64
+ fnv1a_64 (default)
+ fnv1_32
+ fnv1a_32
+ hsieh
Expand All @@ -102,14 +102,15 @@ Twemproxy can be configured through a YAML file specified by the -c or --conf-fi
+ random (choose a random backend for each key of each request)
+ **timeout**: The timeout value in msec that we wait for to establish a connection to the server or receive a response from a server. By default, we wait indefinitely.
+ **backlog**: The TCP backlog argument. Defaults to 512.
+ **tcpkeepalive**: A boolean value that controls if tcp keepalive is enabled for connections to servers. Defaults to false.
+ **preconnect**: A boolean value that controls if twemproxy should preconnect to all the servers in this pool on process start. Defaults to false.
+ **redis**: A boolean value that controls if a server pool speaks redis or memcached protocol. Defaults to false.
+ **redis_auth**: Authenticate to the Redis server on connect.
+ **redis_db**: The DB number to use on the pool servers. Defaults to 0. Note: Twemproxy will always present itself to clients as DB 0.
+ **server_connections**: The maximum number of connections that can be opened to each server. By default, we open at most 1 server connection.
+ **auto_eject_hosts**: A boolean value that controls if server should be ejected temporarily when it fails consecutively server_failure_limit times. See [liveness recommendations](notes/recommendation.md#liveness) for information. Defaults to false.
+ **server_retry_timeout**: The timeout value in msec to wait for before retrying on a temporarily ejected server, when auto_eject_host is set to true. Defaults to 30000 msec.
+ **server_failure_limit**: The number of consecutive failures on a server that would lead to it being temporarily ejected when auto_eject_host is set to true. Defaults to 2.
+ **server_retry_timeout**: The timeout value in msec to wait for before retrying on a temporarily ejected server, when auto_eject_hosts is set to true. Defaults to 30000 msec.
+ **server_failure_limit**: The number of consecutive failures on a server that would lead to it being temporarily ejected when auto_eject_hosts is set to true. Defaults to 2.
+ **servers**: A list of server address, port and weight (name:port:weight or ip:port:weight) for this server pool.


Expand Down Expand Up @@ -231,16 +232,6 @@ If you are deploying twemproxy in production, you might consider reading through

## Packages

### Ubuntu

#### PPA Stable

https://launchpad.net/~twemproxy/+archive/ubuntu/stable

#### PPA Daily

https://launchpad.net/~twemproxy/+archive/ubuntu/daily

## Utils
+ [collectd-plugin](https://github.com/bewie/collectd-twemproxy)
+ [munin-plugin](https://github.com/eveiga/contrib/tree/nutcracker/plugins/nutcracker)
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile to build nutcracker
# ARGS: none
# Also see travis.sh
# Also see test_in_docker.sh
FROM centos:7

ENV LAST_MODIFIED_DATE 2021-04-09
Expand Down
File renamed without changes.
23 changes: 18 additions & 5 deletions tests/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
Python testing facilities for twemproxy, this test suite is based on https://github.com/idning/redis-mgr

already add to https://travis-ci.org/idning/twemproxy as travis-ci
Testing in docker
=================

see https://github.com/idning/twemproxy/blob/travis-ci/travis.sh
The script `test_in_docker.sh` can be run to run all of twemproxy's compiler checks, C unit tests, and this folder's integration tests in docker.

REDIS_VERSION=6.2.4
./test_in_docker.sh $REDIS_VERSION

usage
=====

1. install dependency (redis-py must be 3.0 or newer)::
Information on setting up integration tests, running integration tests, and creating new integration tests is below.

1. install dependencies (redis-py must be 3.0 or newer)::

pip install nose
pip install git+https://github.com/andymccurdy/[email protected]
Expand Down Expand Up @@ -36,7 +42,7 @@ usage

OK

4. add A case::
4. add a case::

cp tests/test_del.py tests/test_xxx.py
vim tests/test_xxx.py
Expand Down Expand Up @@ -69,6 +75,13 @@ T_LOGFILE:
notes
=====

- After all the tests. you get a core dump because we have a case in test_signal which will send SEGV to nutcracker
- After all of the integration tests, you may get a core dump because we have a case in test_signal which will send SEGV to nutcracker

- If tests are failing, you may have to `pkill` redis-server, redis-sentinel, or nutcracker

Unit tests
==========

See src/test_all.c - unit tests are separate from these integration tests and do not require python. They can be compiled and run with `make check`.

To view the output of the failing tests, run `cd src; make test_all; ./test_all`.

0 comments on commit 0a0a1ec

Please sign in to comment.