Skip to content
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

feat(sdk)!: expose simulated resources via HTTP server (attempt 2) #4697

Merged
merged 40 commits into from
Nov 1, 2023

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Oct 27, 2023

Reroll of the changes in #4105. Differences from last time:

  • using the built-in http module instead of express
  • added a small load test (examples/tests/sdk_tests/bucket/load_test.test.w)
  • adjusted some TypeScript import statements to reduce bundle sizes
  • added extra debug logging in the simulator for showing produced bundle sizes
  • handle an additional edge case - simulator HTTP server gracefully returns 500 (instead of crashing) if it receives a request to a resource that has been cleaned up after the simulation shut-down sequence

This PR evolves the Wing simulator so that every simulation spins up an HTTP server. This HTTP server accepts requests to call inflight methods on resources, making it possible for simulated resources to interact across multiple processes on the same machine (such as from containers running on your system).

BREAKING CHANGE: The rawClient() method on ex.Redis has been removed. This API was infrequently used and was provided without any type information. If you have a use case for this API, let us know!

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@Chriscbr Chriscbr changed the title feat(sdk!): expose simulator via HTTP server feat(sdk)!: expose simulator via HTTP server Oct 27, 2023
@Chriscbr Chriscbr changed the title feat(sdk)!: expose simulator via HTTP server feat(sdk)!: expose simulated resources via HTTP server Oct 27, 2023
@monadabot
Copy link
Contributor

monadabot commented Oct 27, 2023

Console preview environment is available at https://wing-console-pr-4697.fly.dev 🚀

Last Updated (UTC) 2023-11-01 22:00

@monadabot
Copy link
Contributor

monadabot commented Oct 27, 2023

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 82ms±2 85ms±1.43 +3ms (+3.63%)⬜
jsii_small.test.w -t sim 652ms±17.81 652ms±8.55 -1ms (-0.13%)⬜
jsii_small.test.w -t tf-aws 803ms±14.57 802ms±11.22 -1ms (-0.07%)⬜
jsii_big.test.w -t sim 3996ms±54.34 3965ms±34.87 -32ms (-0.79%)⬜
jsii_big.test.w -t tf-aws 4123ms±34.58 4110ms±36.43 -13ms (-0.32%)⬜
functions_10.test.w -t sim 752ms±6.47 761ms±12.73 +9ms (+1.2%)⬜
functions_10.test.w -t tf-aws 4386ms±25.87 4399ms±26.17 +13ms (+0.29%)⬜
hello_world.test.w -t sim 690ms±8.44 691ms±6.13 +2ms (+0.25%)⬜
hello_world.test.w -t tf-aws 5522ms±45.16 5504ms±49.1 -18ms (-0.33%)⬜
empty.test.w -t sim 651ms±9.38 645ms±8.33 -6ms (-0.94%)⬜
empty.test.w -t tf-aws 789ms±5.69 802ms±15.44 +13ms (+1.66%)⬜
functions_1.test.w -t sim 689ms±5.75 690ms±9.73 +1ms (+0.09%)⬜
functions_1.test.w -t tf-aws 2285ms±79.92 2309ms±75.63 +24ms (+1.03%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 85ms 82ms 88ms 1ms 2ms
jsii_small.test.w -t sim 652ms 636ms 672ms 9ms 12ms
jsii_small.test.w -t tf-aws 802ms 780ms 834ms 11ms 16ms
jsii_big.test.w -t sim 3965ms 3888ms 4036ms 35ms 49ms
jsii_big.test.w -t tf-aws 4110ms 4048ms 4204ms 36ms 51ms
functions_10.test.w -t sim 761ms 742ms 791ms 13ms 18ms
functions_10.test.w -t tf-aws 4399ms 4330ms 4474ms 26ms 37ms
hello_world.test.w -t sim 691ms 677ms 703ms 6ms 9ms
hello_world.test.w -t tf-aws 5504ms 5393ms 5614ms 49ms 69ms
empty.test.w -t sim 645ms 629ms 669ms 8ms 12ms
empty.test.w -t tf-aws 802ms 784ms 848ms 15ms 22ms
functions_1.test.w -t sim 690ms 661ms 711ms 10ms 14ms
functions_1.test.w -t tf-aws 2309ms 2156ms 2484ms 76ms 106ms
Last Updated (UTC) 2023-11-01 22:10

@Chriscbr Chriscbr marked this pull request as ready for review November 1, 2023 20:39
@Chriscbr Chriscbr requested a review from a team as a code owner November 1, 2023 20:39
@Chriscbr Chriscbr changed the title feat(sdk)!: expose simulated resources via HTTP server feat(sdk)!: expose simulated resources via HTTP server (attempt 2) Nov 1, 2023
Copy link
Contributor

mergify bot commented Nov 1, 2023

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/sim-processes2 is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit 87cdbb3 into main Nov 1, 2023
23 checks passed
@mergify mergify bot deleted the rybickic/sim-processes2 branch November 1, 2023 22:27
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.42.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants