Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update config documentation #426

Merged
merged 14 commits into from
Jun 11, 2019
1 change: 1 addition & 0 deletions docs/user-guide/configure-load-balancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Styx supports three load balancing strategies:

- Power of Two
kvosper marked this conversation as resolved.
Show resolved Hide resolved
- Round robin
kvosper marked this conversation as resolved.
Show resolved Hide resolved
kvosper marked this conversation as resolved.
Show resolved Hide resolved
- Busy

Expand Down
337 changes: 153 additions & 184 deletions docs/user-guide/configure-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,192 +12,161 @@ using environment variables with the same name as the property.
### Example styx-config

```yaml
# A string uniquely identifying the host running the application, must be different for all running instances of the application
# the default value is suitable only for non clustered environments
jvmRouteName: "${jvm.route:noJvmRouteSet}"


proxy:
connectors:
- type: http
# Server port for Styx proxy.
port: 8080

# 0 -> availableProcessors / 2 threads will be used
bossThreadsCount: 1

# styx client worker threads are those performing all the asynchronous I/O operation to the backend origins.
# 0 -> availableProcessors / 2 threads will be used
clientWorkerThreadsCount: 0

# Worker threads are those performing all the asynchronous I/O operation on the inbound channel.
# 0 -> availableProcessors / 2 threads will be used

workerThreadsCount: 0

tcpNoDelay: true
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536


# A timeout for idle persistent connections, in milliseconds.
keepAliveTimeoutMillis: 12000

# Time in milliseconds Styx Proxy Service waits for an incoming request from client
# before replying with 408 Request Timeout.
requestTimeoutMillis: 12000


admin:
connectors:
- type: http
# Server port for Styx admin interface.
port: 9000

# Number of threads for handling incoming connections on admin interface. 0 -> availableProcessors / 2 threads will be used.
bossThreadsCount: 1

# Number of worker threads for admin interface
# Worker threads are those performing all the asynchronous I/O operation on the inbound channel.
# 0 -> availableProcessors / 2 threads will be used
workerThreadsCount: 1

tcpNoDelay: true
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536

# Whether to cache the generated JSON for the /admin/metrics and /admin/jvm pages
metricsCache:
enabled: true
expirationMillis: 10000

loadBalancing:
strategy: #Check load balancing documentation for all the possible strategies
factory: {class: "com.hotels.styx.client.loadbalancing.strategies.PowerOfTwoStrategy$Factory"}



adaptive:
kvosper marked this conversation as resolved.
Show resolved Hide resolved
# Adaptive loadbalancer warm-up count. The count is the number of requests that has to hit the
# load balancer before it upswitches from round robin strategy to least response time strategy.
warmupCount: 100

metrics:
graphite:
enabled: true
# Host of the Graphite endpoint. Overrides the property from CoreFoundation
# A string uniquely identifying the host running the application, must be different for all running instances of the application
# the default value is suitable only for non clustered environments
jvmRouteName: "${jvm.route:noJvmRouteSet}"

proxy:
connectors:
http:
# Server port for Styx proxy.
port: 8080
https:
port: 8443
sslProvider: OPENSSL
sessionTimeoutMillis: 300000
sessionCacheSize: 20000
protocols:
- TLSv1.2
cipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
# 0 -> availableProcessors / 2 threads will be used
kvosper marked this conversation as resolved.
Show resolved Hide resolved
bossThreadsCount: 1
# styx client worker threads are those performing all the asynchronous I/O operation to the backend origins.
# 0 -> availableProcessors / 2 threads will be used
clientWorkerThreadsCount: 0
# Worker threads are those performing all the asynchronous I/O operation on the inbound channel.
# 0 -> availableProcessors / 2 threads will be used
workerThreadsCount: 0
tcpNoDelay: true
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 65536
maxChunkSize: 8192
maxContentLength: 65536
# Time in milliseconds Styx Proxy Service waits for an incoming request from client
# before replying with 408 Request Timeout.
requestTimeoutMillis: 12000
# A timeout for idle persistent connections, in milliseconds.
keepAliveTimeoutMillis: 120000
maxConnectionsCount: 4000


admin:
connectors:
http:
# Server port for Styx admin interface.
port: 9000
# Number of threads for handling incoming connections on admin interface. 0 -> availableProcessors / 2 threads will be used.
bossThreadsCount: 1
# Number of worker threads for admin interface
# Worker threads are those performing all the asynchronous I/O operation on the inbound channel.
# 0 -> availableProcessors / 2 threads will be used
workerThreadsCount: 2
tcpNoDelay: true
kvosper marked this conversation as resolved.
Show resolved Hide resolved
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536

# Whether to cache the generated JSON for the /admin/metrics and /admin/jvm pages
metricsCache:
enabled: true
expirationMillis: 10000

# A list of services that Styx should run upon starting. Any service that can be constructed by a factory extending
# com.hotels.styx.api.configuration.ServiceFactory can be included here
services:
factories:
backendServiceRegistry:
class: "com.hotels.styx.proxy.backends.file.FileBackedBackendServicesRegistry$Factory"
config:
originsFile: "${STYX_HOME}/conf/env-development/origins.yaml"
graphite:
class: "com.hotels.styx.metrics.reporting.graphite.GraphiteReporterServiceFactory"
config:
prefix: "my.metrics"
# Host of the Graphite endpoint.
host: "destination.host"

# Port of the Graphite endpoint. Overrides the property from CoreFoundation
# Port of the Graphite endpoint.
port: 2003

# Graphite reporting interval in milliseconds
intervalMillis: 5000
jmx:
# Enable reporting of metrics via JMX. Overrides the property from CoreFoundation
enabled: true

request-logging:
# Enable logging of requests and responses (with requestId to match them up).
# Logs are produced on server and origin side, so there is an information on
# how the server-side (inbound) and origin-side (outbound) request/response look like.
# In long format log entry contains additionally headers and cookies.
inbound:
enabled: true
longFormat: true
outbound:
enabled: true
longFormat: true

# Determines the format of the response info header
responseInfoHeaderFormat: {INSTANCE};{REQUEST_ID}
intervalMillis: 15000
jmx:
class: "com.hotels.styx.metrics.reporting.jmx.JmxReporterServiceFactory"
config:
domain: "com.hotels.styx"

retrypolicy:
policy:
factory:
class: "com.hotels.styx.client.retry.RetryPolicyFactory"
config: {count: 2}

loadBalancing:
strategy: #Check load balancing documentation for all the possible strategies
factory: {class: "com.hotels.styx.client.loadbalancing.strategies.PowerOfTwoStrategy$Factory"}

originRestrictionCookie: restrict_origins

request-logging:
# Enable logging of requests and responses (with requestId to match them up).
# Logs are produced on server and origin side, so there is an information on
# how the server-side (inbound) and origin-side (outbound) request/response look like.
# In long format log entry contains additionally headers and cookies.
inbound:
enabled: ${REQUEST_LOGGING_INBOUND_ENABLED:false}
longFormat: ${REQUEST_LOGGING_INBOUND_LONG_FORMAT:false}
outbound:
enabled: ${REQUEST_LOGGING_OUTBOUND_ENABLED:false}
longFormat: ${REQUEST_LOGGING_OUTBOUND_LONG_FORMAT:false}

# Configures the names of the headers that Styx adds to messages it proxies (see headers.md)
# If not configured, defaults will be used.
styxHeaders:
styxInfo:
name: "X-Styx-Info"
format: "{INSTANCE};{REQUEST_ID}"
originId:
name: "X-Styx-Origin-Id"
requestId:
name: "X-Styx-Request-Id"

# Configures the names of the headers that Styx adds to messages it proxies (see headers.md)
# If not configured, defaults will be used.
styxHeaders:
styxInfo:
name: "X-Styx-Info"
format: "{INSTANCE};{REQUEST_ID}"
originId:
name: "X-Styx-Origin-Id"
requestId:
name: "X-Styx-Request-Id"

# Enables request tracking. This is a debugging feature that shows information about
# each proxied request. Accepts a boolean value (true/false).
requestTracking: false
# Enables request tracking. This is a debugging feature that shows information about
# each proxied request. Accepts a boolean value (true/false).
requestTracking: false

# Allow and Encode the list of unwise chars.
kvosper marked this conversation as resolved.
Show resolved Hide resolved
url:
encoding:
unwiseCharactersToEncode: "|,;,{,}"

# Configure plugins that Styx will use
plugins:
# List of plugin IDs from the configured plugins under "all". Only the plugins listed in "active" will be loaded.
active: plugin1, plugin2
all:
plugin1:
factory:
# the name of a class that implements com.hotels.styx.api.plugins.spi.PluginFactory
class: "foo.bar.Plugin1Factory"
# the path (directory or jar) from which the factory class can be loaded
classPath: "/foo/bar/"
# configuration for the plugin. the exact structure is up to the plugin creator
config:
foo: "bar"
bar: "foo"
plugin2:
factory:
class: "pack.age.Plugin2Factory"
classPath: "/foo/bar/"
config:
some: "config"
et: "cetera"
```

Without the comments, it looks like this:
```yaml
jvmRouteName: "${jvm.route:noJvmRouteSet}"
proxy:
connectors:
- type: http
port: 8080
bossThreadsCount: 1
clientWorkerThreadsCount: 0
workerThreadsCount: 0
tcpNoDelay: true
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
requestTimeoutMillis: 12000

admin:
connectors:
- type: http
port: 9000
bossThreadsCount: 1
workerThreadsCount: 1
tcpNoDelay: true
nioReuseAddress: true
nioKeepAlive: true
maxInitialLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
metricsCache:
enabled: true
expirationMillis: 10000

loadBalancing:
strategy: "ADAPTIVE"
adaptive:
warmupCount: 100

metrics:
graphite:
enabled: true
host: "destination.host"
port: 2003
intervalMillis: 5000
jmx:
enabled: true

request-logging:
inbound:
enabled: true

styxHeaders:
styxInfo:
name: "X-Styx-Info"
format: "{INSTANCE};{REQUEST_ID}"
originId:
name: "X-Styx-Origin-Id"
requestId:
name: "X-Styx-Request-Id"

requestTracking: false
```