Consider usage of chi router as http framework for gateway #80

Closed
opened 2023-08-31 15:37:46 +00:00 by alexvanin · 1 comment
Owner

Back in the days we chose fasthttp as a framework for our first gateway application, because it was blazing fast and provided non-buffered access to the payload, so we could transfer payload directly to the storage node (see the usage of RequestBodyStream).

Unfortunately, we can't use this framework in other gateways. Fasthttp does not provide convenient routing for large-scale S3 gateway and we use swagger-generated server for REST gateway.

Also it has some caveats e.g. a bit weird work with RequestContext without ability to cancel request

Describe the solution you'd like

Not a while ago we supported chi router in the S3 gateway. Let's see if it provides some zero-buf options to work with payload and let's do some benchmarks.

## Is your feature request related to a problem? Please describe. Back in the days we chose [fasthttp](https://github.com/valyala/fasthttp) as a framework for our first gateway application, because it was blazing fast and provided non-buffered access to the payload, so we could transfer payload directly to the storage node (see the usage of [RequestBodyStream](https://git.frostfs.info/TrueCloudLab/frostfs-http-gw/src/commit/dbc6804d273bf6b9df7b8f9a813e20e5c73835eb/uploader/upload.go#L73)). Unfortunately, we can't use this framework in other gateways. Fasthttp does not provide convenient routing for large-scale S3 gateway and we use swagger-generated server for REST gateway. Also it has some caveats e.g. a bit weird work with `RequestContext` without ability to [cancel request](https://github.com/valyala/fasthttp/issues/1473#issuecomment-1396529070) ## Describe the solution you'd like Not a while ago we supported [chi](https://github.com/go-chi/chi) router in the S3 gateway. Let's see if it provides some zero-buf options to work with payload and let's do some benchmarks.
mbiryukova was assigned by alexvanin 2023-08-31 15:37:46 +00:00
Member

To compare effectiveness of implementations with fasthttp and chi router, 2GB, 5GB and 10GB objects were uploaded. No significant difference was noticed.
There is a problem with headers handling: they transform (e.g. X-Attribute-FilePath → X-Attribute-Filepath) which doesn't allow to correctly set case sensitive attributes in object. Also, in implementation with chi router it wasn't possible to apply some of web settings.

To compare effectiveness of implementations with fasthttp and chi router, 2GB, 5GB and 10GB objects were uploaded. No significant difference was noticed. There is a problem with headers handling: they transform (e.g. X-Attribute-FilePath → X-Attribute-Filepath) which doesn't allow to correctly set case sensitive attributes in object. Also, in implementation with chi router it wasn't possible to apply some of web settings.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#80
No description provided.