Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 2.73 KB

DESIGN-NOTES.md

File metadata and controls

51 lines (40 loc) · 2.73 KB

Handle HTTP

  • Router - Incoming - Read Request (writes response to Lambda, sending the request)
    • The request is already parsed by Kestrel
    • We just need to write out the headers, a blank line, then the body
    • Incoming/Outgoing: We don't even have to figure out the chunk lengths as Kestrel is doing that for us
  • Router - Callback - Read Request (receives response from Lambda, writes response to incoming)
    • The response is written via Kestrel
    • The chunk lengths are already parsed by Kestrel and removed from the body
    • We can write directly to the Incoming response as we read from the Callback Request
    • We can possibly use a CopyToAsync to write the body
    • The only tricky bit is not using StreamReader for the headers
    • This should look most like the ResponseParser in Kestrel
  • Lambda - Incoming - Read Request
  • Lambda - Proxy - Write Response
  • Lambda - KeepAlive on HTTP
    • KeepAlive can be used if we:
      • Read and discard a blank line after the response from the Router
      • Write a blank line after the request to the Router
      • We can then reuse the same socket for the next request/response
      • Use a loop on GetRequest before destroying the TcpReverseRequester
    • This will significantly reduce the socket churn and CPU overhead from that

Kestrel C# Request/Response Parser

Http1ParsingHandler

https://github.com/dotnet/aspnetcore/blob/52364da7f2d8e8956085a92c2f6b9dae48ac130d/src/Servers/Kestrel/Core/src/Internal/Http/Http1ParsingHandler.cs

HttpParser

https://github.com/dotnet/aspnetcore/blob/52364da7f2d8e8956085a92c2f6b9dae48ac130d/src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs

AWS Docs

Lambda Invoke Request

https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html

Lambda Runtime Endpoints and Requests

https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html