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

E2E for useServerlessTraceTarget #787

Merged
merged 4 commits into from
Nov 11, 2020
Merged

Conversation

danielcondemarin
Copy link
Contributor

@danielcondemarin danielcondemarin commented Nov 11, 2020

This is literally a copy of e2e-tests/next-app with one difference, it sets useServerlessTraceTarget: true.

I think we should aim to set serverless trace as the default build target in future, maybe for 1.19. Hopefully the last few fixes and #779 have made it stable enough.

@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #787 (384b3ff) into master (8f978bb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #787   +/-   ##
=======================================
  Coverage   80.00%   80.00%           
=======================================
  Files          56       56           
  Lines        1835     1835           
  Branches      406      406           
=======================================
  Hits         1468     1468           
  Misses        309      309           
  Partials       58       58           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f978bb...384b3ff. Read the comment docs.

@dphang
Copy link
Collaborator

dphang commented Nov 11, 2020

@danielcondemarin LGTM besides that.

I'm not so sure about setting serverless trace target as the default build though, since although it reduces code duplication, it can have cold start perf impact, since it's now having to load a bunch of smaller JS modules instead of a single file for a page. From my experience AWS Lambda code size has very little impact on cold start, it's more the I/O/requires that makes up the majority of the time.

There are ways to optimize code size like minifying the pages JS files or manually removing page JS only used for pre-rendering (e.g we do it automatically if you do not use any API routes). I added postBuildCommands input which can help with this if you do use API routes, but you need to manually specify which JS files are safe to remove. It is also the user's responsibility to ensure they are not importing libraries in a way that prevents proper tree-shaking (material-ui is often a culprit, if you use top-level imports).

@danielcondemarin
Copy link
Contributor Author

danielcondemarin commented Nov 11, 2020

I'm not so sure about setting serverless trace target as the default build though, since although it reduces code duplication, it can have cold start perf impact, since it's now having to load a bunch of smaller JS modules instead of a single file for a page. From my experience AWS Lambda code size has very little impact on cold start, it's more the I/O/requires that makes up the majority of the time.

That's a fair point. I'm mainly proposing the change because the Next team uses this as their build target for Vercel deployments. The other is that I suspect they will be deprecating the serverless target.
Happy to keep serverless-trace as an opt-in for now. I might do a bit more digging on this area and post any findings.

@danielcondemarin danielcondemarin merged commit 2a96cde into master Nov 11, 2020
@delete-merged-branch delete-merged-branch bot deleted the add-serverless-trace-e2e branch November 11, 2020 23:53
@dphang
Copy link
Collaborator

dphang commented Nov 11, 2020

I'm not so sure about setting serverless trace target as the default build though, since although it reduces code duplication, it can have cold start perf impact, since it's now having to load a bunch of smaller JS modules instead of a single file for a page. From my experience AWS Lambda code size has very little impact on cold start, it's more the I/O/requires that makes up the majority of the time.

That's a fair point. I'm mainly proposing the change because the Next team uses this as their build target for Vercel deployments. The other is that I suspect they will be deprecating the serverless target.
Happy to keep serverless-trace as an opt-in for now. I might do a bit more digging on this area and post any findings.

Yep, I did try Vercel's deployment and found it slow for that same reason - a while back I had opened an issue but had no responses. I hope they do not remove the serverless target.

@dphang
Copy link
Collaborator

dphang commented Nov 11, 2020

@@ -0,0 +1,25 @@
module.exports = function (...args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, overlooked this, I will fix for you @danielcondemarin

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.

2 participants