igalshilman opened a new pull request #252:
URL: https://github.com/apache/flink-statefun/pull/252


   ### Add an asynchronous HTTP transport
   
   This PR adds a new transport type (` io.statefun.transports.v1/async`) for 
StateFun `endpoints` that is based on an asynchronous non blocking IO.
   
   ### Configuration
   
   The following is a complete example (specifically the `transport` section) 
taken from the e2e smoke test for the Java SDK:
   
   ```
   kind: io.statefun.endpoints.v2/http
   spec:
     functions: statefun.smoke.e2e/command-interpreter-fn
     urlPathTemplate: http://remote-function-host:8000
     maxNumBatchRequests: 10000
     transport:
       type: io.statefun.transports.v1/async
       call: 2m
       connect: 20s
       pool_ttl: 15s
       pool_size: 1024
       payload_max_bytes: 33554432
   ```
   
   * `call` - this is the total duration of a single request (including 
retries, and backoffs) after that duration the call is considered failed, and 
an appropriate exception Is thrown.
   * `connect` - the total amount of time to wait for a successful TCP 
connection. After that amount of time an attempt is considered to be failed, 
and if the total `call` time has not elasped, an additional attempt will 
scheduled (after a backoff)
   * `pool_ttl` the amount of time a connection will live in a connection pool. 
set to 0 to disable, otherwise the connection will be evicted from the pool 
after (approximately) that time. If this connection TTLed while it is serving a 
request, that connection will be only marked as TTLed and will be dropped from 
the pool once returned.
   * `pool_size` the maximum pool size.
   * `payload_max_bytes` the maximum size for a request or response payload 
size. The default is set to 32MB.
   
   #### People who like that config also liked "statefun.async.max-per-task"  
:-)
   
   As of master, we apply back-pressure once there are concurrently 1024 
requests in flight (per core), this is an artifact of an old threaded, blocking 
transport. With this transport, it is recommended to bump the value of 
`statefun.async.max-per-task`
   To something way higher. I've tested with 32k, 64k and the sky is the limit.
   
   ### Features
   
   * Completely asynchronous and non blocking via the magnificent Netty 
framework.
   * built in efficient Protobuf serialization/deserialization (directly to 
direct memory)
   * connection pooling
   * only HTTP/1.1 for now, but 2 and websockets are followups
   * compression
   * TLS (via openssl)
   * Retries and backoffs
   
   
   ### Testing
   
   * Some of the logic is tested in isolation in unit tests.
   * The transport was testing in various stress scenarios, like running 
against a server with little file descriptors, or that stalls responses, or 
just get `kill -9`.
   * The default transport for the java e2e smoke test is changed to use this 
transport.
   
   ### What is missing
   
   * HTTP2 / 3 support
   * Unix domain socket support
   * Different DNS resolvers, specifically for headless k8s services.
   * More integration tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to