roadrunner icon indicating copy to clipboard operation
roadrunner copied to clipboard

[💡FEATURE REQUEST]: Extend http server configuration options

Open rustatian opened this issue 4 years ago • 6 comments

Extend http section with http server configuration options, such as: read-write timeouts, header size etc..

rustatian avatar Dec 21 '20 08:12 rustatian

We can extend HTTP/FCGI server options with the following:

ReadTimeout:       config,
ReadHeaderTimeout: config,
WriteTimeout:      config,
IdleTimeout:       config,
MaxHeaderBytes:    config,

HTTP2 server:

MaxHandlers:                  config,
MaxConcurrentStreams:         config,
MaxReadFrameSize:             config,
PermitProhibitedCipherSuites: config,
IdleTimeout:                  config,
MaxUploadBufferPerConnection: config,
MaxUploadBufferPerStream:     config,

rustatian avatar Dec 26 '20 12:12 rustatian

We can extend HTTP/FCGI server options with the following:

ReadTimeout:       config,
ReadHeaderTimeout: config,
WriteTimeout:      config,
IdleTimeout:       config,
MaxHeaderBytes:    config,

HTTP2 server:

MaxHandlers:                  config,
MaxConcurrentStreams:         config,
MaxReadFrameSize:             config,
PermitProhibitedCipherSuites: config,
IdleTimeout:                  config,
MaxUploadBufferPerConnection: config,
MaxUploadBufferPerStream:     config,

why is config there? is it an abstract type?

ohDaddyPlease avatar Jan 18 '21 12:01 ohDaddyPlease

why is config there?

It's just a placeholder for GitHub, which means, that value should be taken from the config.

rustatian avatar Jan 18 '21 13:01 rustatian

@48d90782 do i understand correctly, we extends FCGIConfig and HTTP2Config? also we need to add options to server config for Fcgi and HTTP2? is that right way?

ohDaddyPlease avatar Jan 18 '21 15:01 ohDaddyPlease

@ohDaddyPlease Let me explain, it's my bad :) We extend the http section in the .rr.yaml (which is located in the root). You need to add, right after the http section, configuration options for the http (yaml), and http2 options, right after the http2 key in the http. It should look like the following:

http:
  address: 127.0.0.1:44933
  max_request_size: 1024
  read_timeout: 10s #seconds
  read_header_timeout: 10s #seconds,
  write_timeout: 10s #seconds,
  idle_timeout: 10s #seconds,
  max_header_bytes:    1000,
  middleware: [ "gzip", "headers" ]
  uploads:
    forbid: [ ".php", ".exe", ".bat" ]
  trusted_subnets:
    [
        "10.0.0.0/8",
        "127.0.0.0/8",
        "172.16.0.0/12",
        "192.168.0.0/16",
        "::1/128",
        "fc00::/7",
        "fe80::/10",
    ]
  pool:
    num_workers: 6
    max_jobs: 0
    allocate_timeout: 60s
    destroy_timeout: 60s
    supervisor:
      # WatchTick defines how often to check the state of worker (seconds)
      watch_tick: 1
      # TTL defines maximum time worker is allowed to live (seconds)
      ttl: 0
      # IdleTTL defines maximum duration worker can spend in idle mode. Disabled when 0 (seconds)
      idle_ttl: 100
      # ExecTTL defines maximum lifetime per job (seconds)
      exec_ttl: 10
      # MaxWorkerMemory limits memory per worker (MB)
      max_worker_memory: 100
  http2:
    enabled: false
    h2c: false
    max_concurrent_streams: 128
    max_handlers:                  config,
    max_read_frame_size: config,
    permit_prohibited_cipher_suites: bool,
    idle_timeout: config,
    max_upload_buffer_per_connection: config,
    max_upload_buffer_per_stream: config,

Default values should be taken from the http.Server standard library, and should be set by the InitDefaults method (config.go). Then, these values should be set:

  1. for the http2: https://github.com/spiral/roadrunner/blob/2.0/plugins/http/config.go#L80
  2. for the http: https://github.com/spiral/roadrunner/blob/2.0/plugins/http/config.go#L38 Also, values should be documented in the roadrunner-dev repository and structure fields should also have comments (yaml too)

rustatian avatar Jan 19 '21 12:01 rustatian

@ohDaddyPlease Do you have any plans to work on this ticket?

rustatian avatar Mar 03 '21 16:03 rustatian