Experimental Features

Introduction

Starting from the RR v2023.3.4 release, we have introduced a new feature called Experimental Features. This feature allows you to try out new features that are not yet ready for production use.

How to enable experimental features

To enable experimental features, you need to run RR with the -e (--enable-experimental) flag. For example:

./rr serve -e

Or:

./rr serve --enable-experimental

List of experimental features

Support for the nested configurations: [>=2023.3.4].

Using the following syntax, you may include other configuration files into the main one:

yaml
.rr.yaml
version: "3"

include:
  - .rr.include1-sub1.yaml
  - .rr.include1-sub2.yaml

reload:
  interval: 1s
  patterns: [".php"]

Where .rr.include1-sub1.yaml and .rr.include1-sub2.yaml are the configuration files that are located in the same directory as the main configuration file. Includes override the main configuration file. For example, if you have the following nested configuration:

yaml
.rr.include1-sub1.yaml
version: "3"

server:
  command: "php php_test_files/psr-worker-bench.php"
  relay: pipes

http:
  address: 127.0.0.1:15389
  middleware:
    - "sendfile"
  pool:
    allocate_timeout: 10s
    num_workers: 2

It will override the server and http sections of the main configuration file. You may use env variables in the included configuration files, but you can't use overrides for the nested configuration. For example:

Note
The next 'include' will override values set by the previous 'include'. Values in the root .rr.yaml will be overwritten by the includes as well. Feel free to send us feedback on this feature.

yaml
.rr.include1-sub1.yaml
version: "3"

server:
  command: "${PHP_COMMAND:-php_test_files/psr-worker-bench.php}"
  relay: pipes

You may use any number of the included configuration files via CLI command, in quotas and separated by whitespace. For example:

./rr serve -e -c .rr.yaml -o include=".rr.yaml .rr2.yaml"

Support for loading envfiles in the .rr.yaml: [>= v2023.3.5]

In the v2023.3.5 added experimental support for loading envfiles in the .rr.yaml configuration file. .env file should be in the same directory as the .rr.yaml file.

Sample .rr.yaml file:

yaml
.rr.yaml
version: "3"
envfile: .env

Support for the HTTP3 server: [>=2023.3.8].

In the v2023.3.8 we added experimental support for the HTTP3 server. It can work with the ACME provider to generate certificates for the HTTP3 server automatically.

Sample .rr.yaml file:

yaml
.rr.yaml
version: "3"

server:
  command: "php worker.php"
  relay: pipes

http:
  address: 127.0.0.1:15389
  pool:
    num_workers: 2
  http3:
    address: 127.0.0.1:34555
    key: "localhost+2-key.pem"
    cert: "localhost+2.pem"

Or if you use ACME provider:

yaml
.rr.yaml
version: "3"

server:
  command: "php worker.php"
  relay: pipes

http:
  address: 127.0.0.1:15389
  pool:
    num_workers: 2
  http3:
    address: 127.0.0.1:34555
    key: "localhost+2-key.pem"
    cert: "localhost+2.pem"
  ssl:
    acme:
      certs_dir: rr_le_certs
      email: you-email-here@email
      alt_http_port: 80
      alt_tlsalpn_port: 443
      challenge_type: http-01
      use_production_endpoint: false
      domains:
        - your-cool-domains.here

You may also generate testing certificates manually and use them in the configuration file. To do that, you may use mkcert or certbot:

mkcert -install && mkcert -client localhost 127.0.0.1 ::1 && mkcert localhost 127.0.0.1 ::1

This command will generate the client and server certificates for the localhost domain. You may use them in the configuration file:

yaml
.rr.yaml
version: "3"

server:
  command: "php worker.php"
  relay: pipes

http:
  address: 127.0.0.1:15389
  pool:
    num_workers: 2
  http3:
    address: 127.0.0.1:34555
    key: "localhost+2-key.pem" # <- generated by mkcert: "localhost+2-key.pem"
    cert: "localhost+2.pem" # <- generated by mkcert: "localhost+2.pem"

Client certificates might be used in your favorite http3 client. For example, you may use curl3 to test the HTTP3 server:

curl3 --http3 -k --cert localhost+2.pem --key localhost+2-key.pem https://127.0.0.1:34555/

OTLP support in the gRPC plugin: [>=2023.3.8].

In the v2023.3.8 we added experimental support for the OTLP protocol in the gRPC plugin. To enable it, you need to activate otel plugin by adding the following lines to the .rr.yaml file:

yaml
.rr.yaml
otel: # <- activate otel plugin
  resource:
    service_name: "rr_test_grpc"
    service_version: "1.0.0"
    service_namespace: "RR-gRPC"
    service_instance_id: "UUID-super-long-unique-id"
  insecure: false
  exporter: stderr

Trace keys passed to the PHP workers are:

  1. Traceparent
  2. Uber-Trace-Id

Example:

log
"Traceparent":["00-2678b910f57fe3320587f4126a390868-6b87f1600005b643-01"],"Uber-Trace-Id":["2678b910f57fe3320587f4126a390868:6b87f1600005b643:0:1"]

More about OTLP plugin you may read here.

Edit this page