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

Use ETag caching when running from source #148642

Closed
alexdima opened this issue May 3, 2022 · 1 comment
Closed

Use ETag caching when running from source #148642

alexdima opened this issue May 3, 2022 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders server verified Verification succeeded
Milestone

Comments

@alexdima
Copy link
Member

alexdima commented May 3, 2022

Follow up from #147311 (comment)

Doing the following steps:

  • scripts/code-server.sh
  • open the web ui
  • uncheck "Disable caching" in DevTools
  • cause a page load by pressing Enter in the URL bar (cmd+r sometimes is interpreted by some browsers as load without cache, so use that if your browser doesn't disable caching when pressing it)

Without ETag (59.5MB transferred, page load 3.82s):

image

With ETag (275kB transferred, page load 2.83s)

  • apply the patch:
diff --git a/src/vs/server/node/webClientServer.ts b/src/vs/server/node/webClientServer.ts
index 6053e046a51..11e361ee77d 100644
--- a/src/vs/server/node/webClientServer.ts
+++ b/src/vs/server/node/webClientServer.ts
@@ -158,7 +158,7 @@ export class WebClientServer {
 			return serveError(req, res, 400, `Bad request.`);
 		}
 
-		return serveFile(filePath, this._environmentService.isBuilt ? CacheControl.NO_EXPIRY : CacheControl.NO_CACHING, this._logService, req, res, headers);
+		return serveFile(filePath, this._environmentService.isBuilt ? CacheControl.NO_EXPIRY : CacheControl.ETAG, this._logService, req, res, headers);
 	}
 
 	private _getResourceURLTemplateAuthority(uri: URI): string | undefined {

Do the same steps:
image

This pays off especially when using a codespace to develop vscode web, etc.

@aeschli
Copy link
Contributor

aeschli commented May 3, 2022

Ok, convinced, thanks for the measurements!

@aeschli aeschli closed this as completed in 864c20e May 3, 2022
@aeschli aeschli added this to the May 2022 milestone May 3, 2022
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label May 3, 2022
@roblourens roblourens added the verified Verification succeeded label Jun 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders server verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants
@roblourens @alexdima @aeschli and others