Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gmethvin
Copy link
Member

Fixes #8089

This refactors the request handling code in the AkkaHttpServer and NettyServer slightly, so that the action is always executed in a future using the Play default execution context, then that future is flatMapped with a function that runs the body accumulator, and the resulting future is recovered using the error handler.

I added a test that tests with both the Filter and EssentialFilter case.

@gmethvin gmethvin force-pushed the filter-error-handler branch 2 times, most recently from a48add9 to 3b56952 Compare December 12, 2017 06:22
lazy val PlayFramework = Project("Play-Framework", file("."))
.enablePlugins(PlayRootProject)
.enablePlugins(PlayWhitesourcePlugin)
//.enablePlugins(PlayWhitesourcePlugin)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you run into the same error as me, actually what helped is just remove all target folders or checkout the source code again.

Copy link
Member

Choose a reason for hiding this comment

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

The same happened to me once. Confirming that removing all target folders resolve the problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove this. I just ran into the error and didn't have time to figure it out.

@schmitch
Copy link
Contributor

schmitch commented Dec 12, 2017

does this have a performance impact?

@gmethvin gmethvin force-pushed the filter-error-handler branch from 3b56952 to 1702333 Compare December 12, 2017 20:52
@gmethvin
Copy link
Member Author

Okay so I ran Play-Microbenchmark/jmh:run -i 5 -wi 5 -f1 -t4 play.microbenchmark.it.HelloWorldBenchmark

Before:

[info] Benchmark                       (endpoint)  (reqsPerConn)   Mode  Cnt      Score      Error  Units
[info] HelloWorldBenchmark.helloWorld   nt-11-pln              5  thrpt    5  24407.809 ± 3284.289  ops/s
[info] HelloWorldBenchmark.helloWorld   nt-11-enc              5  thrpt    5  24058.859 ± 9721.483  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-11-pln              5  thrpt    5  20829.463 ± 9841.523  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-11-enc              5  thrpt    5  14978.026 ± 2929.331  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-20-enc              5  thrpt    5   8906.489 ± 5659.373  ops/s

After:

[info] Benchmark                       (endpoint)  (reqsPerConn)   Mode  Cnt      Score      Error  Units
[info] HelloWorldBenchmark.helloWorld   nt-11-pln              5  thrpt    5  24209.883 ± 4650.606  ops/s
[info] HelloWorldBenchmark.helloWorld   nt-11-enc              5  thrpt    5  22155.185 ± 9727.310  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-11-pln              5  thrpt    5  19364.448 ± 6954.653  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-11-enc              5  thrpt    5  14367.340 ± 7419.241  ops/s
[info] HelloWorldBenchmark.helloWorld   ak-20-enc              5  thrpt    5   8522.170 ± 2350.906  ops/s

It seems like it may have slowed things down very slightly but it's hard to tell.

@schmitch
Copy link
Contributor

well I would say this is fine. it's still in the derivation.


trait HttpFiltersSpec extends PlaySpecification with ServerIntegrationSpecification {

sequential
Copy link
Member

Choose a reason for hiding this comment

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

BTW, with new integration tests you can use the new "endpoint" integration test style which (a) avoids global state so we can do parallel testing and (b) has tests for HTTPS and HTTP/2.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I moved to the new endpoint integration style.

}

@deprecated("This method is an internal API and should not be public", "2.6.10")
def executeAction(
Copy link
Member

Choose a reason for hiding this comment

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

I agree it makes sense to deprecate this.

@gmethvin gmethvin force-pushed the filter-error-handler branch from 8b11f76 to ed35af6 Compare December 13, 2017 21:38
@gmethvin gmethvin merged commit 033cf45 into playframework:master Dec 13, 2017
@gmethvin gmethvin deleted the filter-error-handler branch December 13, 2017 23:06
@gmethvin
Copy link
Member Author

backport to 2.6.x: 3d784e9

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.

4 participants