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

A question of speed with Response Compression Middleware #179

Closed
guardrex opened this Issue Nov 28, 2016 · 9 comments

Comments

Projects
None yet
8 participants
@guardrex

guardrex commented Nov 28, 2016

I just performed a little benchmarking here for Response Compression middleware vs. IIS's compression module. I hope I screwed up the test or my testing on my dev box explains this, because I'm not feel'in these figures.

App 1

Self-contained .NET Core Kestrel/MVC/Razor app (1.1)
IIS configured with Dynamic Compression enabled

App 2

Exact copy of App 1 with Response Compression middleware
IIS configured with Dynamic Compression disabled

I confirmed both working by hitting their endpoints with Fiddler and an Accept-Encoding: gzip header. Both returned gzipped responses. IIS had the additional feature of auto-adding the Vary: Accept-Encoding header to the response. I didn't bother adding that to App 2. This was just meant to be a little quick-n-dirty test.

Result

Using JMeter on my dev machine where the apps were hosted in IIS local. I took (32 threads, 500 loops) ~20K samples on each and found ...

App 1 (IIS) App 2 (Middleware)
28.22 KB/s 21.28 KB/s

... a large-ish ~33% diff.

I'm look'in down the road to the wonderful concept of ditching IIS totally when Kestrel can run as a public-facing server. If Kestrel doesn't offer compression, then the middleware will be the way to go. However, it seems slow. Can you comment on these figures? Do you think that's expected, or do you think my test is whacked?

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Nov 28, 2016

Member

I suggest also testing kestrel+middleware without IIS.

Member

Tratcher commented Nov 28, 2016

I suggest also testing kestrel+middleware without IIS.

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Nov 28, 2016

Member

Honestly we haven't compared the two. For this version we were more concerned about providing the basic functionality for non-IIS scenarios (e.g. direct WebListener and Kestrel). We did do a basic profile and identified a few issues with the GZipStream that the CLR team has started to address (dotnet/corefx#12549).

Member

Tratcher commented Nov 28, 2016

Honestly we haven't compared the two. For this version we were more concerned about providing the basic functionality for non-IIS scenarios (e.g. direct WebListener and Kestrel). We did do a basic profile and identified a few issues with the GZipStream that the CLR team has started to address (dotnet/corefx#12549).

@guardrex

This comment has been minimized.

Show comment
Hide comment
@guardrex

guardrex Nov 28, 2016

I slimmed down the test app. For example, I dropped logging and static file middleware. The results are more consistent between App 2 on IIS and App 2 on Kestrel than I imagined. I thought IIS would add some noticeable latency. Anyway ...

Overall, it looks like middleware is a bit slower. The difference here is ~28%, similar to my OP.

KB/s

Run App 1 (IIS) App 2 (MW on IIS) App 2 (MW on Kestrel)
1 392 305 304
2 324 252 251
3 315 245 245
4 311 242 242
5 314 244 244
Avg 331 258 257
SD 34 27 26

guardrex commented Nov 28, 2016

I slimmed down the test app. For example, I dropped logging and static file middleware. The results are more consistent between App 2 on IIS and App 2 on Kestrel than I imagined. I thought IIS would add some noticeable latency. Anyway ...

Overall, it looks like middleware is a bit slower. The difference here is ~28%, similar to my OP.

KB/s

Run App 1 (IIS) App 2 (MW on IIS) App 2 (MW on Kestrel)
1 392 305 304
2 324 252 251
3 315 245 245
4 311 242 242
5 314 244 244
Avg 331 258 257
SD 34 27 26

@guardrex guardrex closed this Nov 28, 2016

@davidfowl davidfowl reopened this Nov 28, 2016

@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Nov 28, 2016

Member

Re-opening this.

/cc @mikeharder Another middleware to add to the benchmarks.

Member

davidfowl commented Nov 28, 2016

Re-opening this.

/cc @mikeharder Another middleware to add to the benchmarks.

@guardrex guardrex referenced this issue Nov 30, 2016

Closed

Document new features in ASP.NET Core 1.1 #2260

12 of 12 tasks complete

@muratg muratg added this to the 1.2.0 milestone Jan 10, 2017

@muratg muratg modified the milestones: 2.0.0-preview1, 2.0.0-preview2 Apr 21, 2017

@muratg muratg modified the milestones: 2.0.0-preview3, 2.0.0-preview2 May 25, 2017

@muratg muratg modified the milestones: 2.1.0, 2.0.0 Jun 27, 2017

@mikeharder mikeharder removed their assignment Aug 17, 2017

@muratg muratg added perf and removed 1 - Ready labels Oct 30, 2017

@muratg

This comment has been minimized.

Show comment
Hide comment
@muratg

muratg Oct 30, 2017

Member

@sebastienros is this something in your queue already?

Member

muratg commented Oct 30, 2017

@sebastienros is this something in your queue already?

@sebastienros

This comment has been minimized.

Show comment
Hide comment
@sebastienros

sebastienros Oct 30, 2017

Member

@muratg Was not aware of this issue. Do we need to track the results or just have a a new snapshot?

Member

sebastienros commented Oct 30, 2017

@muratg Was not aware of this issue. Do we need to track the results or just have a a new snapshot?

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Oct 30, 2017

Member

Tracking is optional, most of the perf is controlled by IIS and corefx. We primarily want to know how the perf of corefx compares to that of IIS/Express for dynamic compression.

Member

Tratcher commented Oct 30, 2017

Tracking is optional, most of the perf is controlled by IIS and corefx. We primarily want to know how the perf of corefx compares to that of IIS/Express for dynamic compression.

@muratg muratg modified the milestones: 2.1.0, 2.1.0-preview2, Discussions Feb 16, 2018

@speige

This comment has been minimized.

Show comment
Hide comment
@speige

speige commented Feb 24, 2018

+1

@aspnet-hello

This comment has been minimized.

Show comment
Hide comment
@aspnet-hello

aspnet-hello Sep 24, 2018

We periodically close 'discussion' issues that have not been updated in a long period of time.

We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

aspnet-hello commented Sep 24, 2018

We periodically close 'discussion' issues that have not been updated in a long period of time.

We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

@aspnet-hello aspnet-hello removed this from the Discussions milestone Sep 24, 2018

@aspnet aspnet locked and limited conversation to collaborators Sep 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.