Skip to content

Replaced hyper + tokio with our own custom API server implementation #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 23, 2019

Conversation

georgepisaltu
Copy link
Contributor

@georgepisaltu georgepisaltu commented Oct 9, 2019

Reason for This PR

Fixes: #1193 #1194 #615

Description of Changes

The old hyper implementation of the API server is now replaced with another which uses our own HttpServer. The old api_server interface is refactored. It is now much easier to add API changes to Firecracker, as demonstrated in the commits.

Upsides

  • release build time down from 2m09s to 1m49s (-21.6%)
  • debug build time down from 50s to 40s (-20%)
  • release binary size down from 2.956 KiB to 2.659 KiB (-10.1%)
  • debug binary size down from 47.4 MiB to 36.5 MiB (-23%)
  • resident memory usage on a basic configuration down from 1952 KiB to 1468 KiB (-24.8%)
  • 956 fewer lines of code (+1091-55 LOC in this PR are the HttpServer implementation)
  • 30 fewer dependencies, down from 104 to 74 (-28.8%)
  • average request response time down from 1.122 ms/req to 0.766 ms/req (-31.7%)
  • no more futures ✨

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

PR Checklist

  • All commits in this PR are signed (git commit -s).
  • This PR is linked to multiple issues.
  • The description of changes is clear and encompassing.
  • No docs need to be updated as part of this PR.
  • Code-level documentation for touched code is included in this PR.
  • No API changes are included in this PR`. 😆
  • The changes in this PR have no user impact.

@georgepisaltu georgepisaltu changed the title Api server Replaced hyper + tokio with our own custom API server implementation Oct 9, 2019
@georgepisaltu georgepisaltu force-pushed the api_server branch 5 times, most recently from cb7b856 to de0be0a Compare October 15, 2019 08:39
@dhrgit dhrgit self-requested a review October 15, 2019 08:50
@sandreim sandreim self-requested a review October 17, 2019 13:05
@georgepisaltu georgepisaltu force-pushed the api_server branch 2 times, most recently from 9c0571c to 20e62fb Compare October 18, 2019 16:26
`HttpServer` is a struct that leverages `HttpConnection` for
exchanging data with a client and `epoll` to be able to run
on the same thread as the rest of the code.

Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Replaced the existing API Server with a new one which
uses HttpServer instead of using Hyper and Tokio.

This reduces the number of dependencies from 104 to 74.
Using this new ApiServer enables much easier addition of
new API requests, as can be seen in the following commits.

This commit only brings in the ApiServer framework plus processing
MMDS and InstanceInfo requests, the following commits will provide
processing of the other Firecracker URLs.

Signed-off-by: George Pisaltu <gpl@amazon.com>
The renamed method only adds EPOLLIN events. Renamed it for clarity.

Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
@georgepisaltu georgepisaltu force-pushed the api_server branch 2 times, most recently from c7d1257 to be5e9a8 Compare October 23, 2019 07:58
Signed-off-by: George Pisaltu <gpl@amazon.com>
The format for the error log has changed and this commit updates
it to reflect the changes.

Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
Signed-off-by: George Pisaltu <gpl@amazon.com>
@georgepisaltu georgepisaltu merged commit c398f9f into firecracker-microvm:master Oct 23, 2019
@acatangiu acatangiu mentioned this pull request Oct 23, 2019
7 tasks
@georgepisaltu georgepisaltu deleted the api_server branch July 7, 2020 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement HTTP Server
4 participants