Skip to content

Optimize skb operations on HTTP/2 frames allocation #2508

@krizhanovsky

Description

@krizhanovsky

The task is separated from #1411 (comment)

During making HTTP2 frames we transform skb each time, when we insert frame header. May be it will be a good idea to allocate a page, use it and get() it for all inserted headers. Or reserve some more room in the allocated skb pages. This is probably an unlikely case, see discussion #1973 (comment) .

If we proxy a response, then probably the proposed approach is too sophisticated. However, in tfw_http_req_cache_cb() -> tfw_cache_add_body_page() we do a stupid things: we allocate a lot of skbs and fill them fully with the cached data. Next, in tfw_h2_make_frames() we adjust all the skbs to insert the header frames, TLS headers and split the pages and skbs if we need smaller skbs. Maybe this should be fixed in #498 or #2108, but it doesn't look right.

Regarding the original problem, it seems this is about https://github.com/tempesta-tech/tempesta/blob/master/fw/http_frame.c#L1951 : CONTINUATION and DATA frames don't seem rate cases.

An option for proxied messages could be to preallocate some space for HTTP frames headers in skb, like we do this for TLS headers. We also discussed skb splits, which are hard to avoid. However, it's not necessary to always fill the available window, e.g. if we have TCP window of 100 bytes and 3 skbs to proxy, each of 40 bytes, then we can send only the first 2 skbs. Some cleaver heuristic is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions