Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

improvements to play-java - #40

Merged
TechEmpower merged 1 commit into
TechEmpower:masterfrom
pk11:master
Apr 4, 2013
Merged

TechEmpower merged 1 commit into
TechEmpower:masterfrom
pk11:master

Conversation

@pk11

@pk11 pk11 commented Mar 31, 2013

Copy link
Copy Markdown
Contributor
  • thread-safe jackson ObjectMapper is kept on class level
  • blocking tasks were moved off from main thread pool
  • increased default threadpool size as well as configured Akka plugin for blocking tasks

- thread-safe jackson ObjectMapper is kept on class level
- blocking tasks were moved off from main thread pool
- increased default threadpool size as well as configured Akka plugin for blocking tasks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't each one of these finds be executed in parallel? From memory I think that is what the node sample is doing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure how much that would buy us in practice, considering that we are also limited by the db pool, but I guess it's worth a try. I will look into it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The play-scala executes each one in parallel so we should be consistent there. I shall do a PR and fix that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry about the delay! I have not not sent a new PR since my benchmarks were inconclusive. The next thing I wanted to try is increase the db pool size and send everything via Futures but if you are already on this, I will let you handle it :)

@TechEmpower
TechEmpower merged commit 4abc468 into TechEmpower:master Apr 4, 2013
@TechEmpower

Copy link
Copy Markdown
Collaborator

Thanks @pk11! You mentioned you might be working on a few other changes (database pool perhaps?), so we're looking forward to the next pull request.

@huntc

huntc commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

Now created #63 in terms of my contributions mainly around async db handling

@OlegYch

OlegYch commented Apr 5, 2013

Copy link
Copy Markdown

why do you guys use default settings for db pool (10 connections)
other frameworks seem to use several hundreds

@OlegYch

OlegYch commented Apr 5, 2013

Copy link
Copy Markdown

same for play-scala

@pk11

pk11 commented Apr 5, 2013

Copy link
Copy Markdown
Contributor Author

@OlegYch yep, that's a good point, I noticed that too, hence my comment above.

@huntc

huntc commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

I'm going to create another PR w.r.t. sizing the connection pool. The PR should be up in the next hour or so.

@bhauer

bhauer commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

Thanks for picking that one up. I think you guys have told us about the connection pool size a couple times but we didn't get the change done ourselves.

@huntc

huntc commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

@bhauer may be you can let me know quickly - what's the max number of connections you've been configuring elsewhere?

@bhauer

bhauer commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

I can only speak definitively to Gemini since I set that one up, and in that case we use a little over 256 so that we can be sure to have one "ready" database connection available for every active HTTP connection. Without knowing the particular behavior of Play, my instinct is that you would want to have the same number for the same reason.

Although I wrote the Servlet test as well, I used the stock MySQL connection pool in that case, and I believe it too is using a similar number but don't quote me on that.

@huntc

huntc commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

Thanks. Looking at the node configuration there is a max of 800 connections and a concurrency level of 100. I'll try and reproduce that and then see where we're at.

@huntc

huntc commented Apr 5, 2013

Copy link
Copy Markdown
Contributor

#96 is my placeholder for connection pooling changes

@Skamander

Copy link
Copy Markdown

I implemented something like that in my fork, and it seems to be 2 - 3 times faster: https://groups.google.com/d/msg/play-framework/SX_pg7fVQ0A/ciDCs8NMRFkJ

The commit:

https://github.com/Skamander/FrameworkBenchmarks/commit/843fa9a96b03dbc5e1e6ecf51759fa01d06aa791

Maybe you can use this to compare it with your changes. It uses 96 Threads for the DB and 96 Threads for the FutureContext to match that.

EDIT - the idea behind this was to not to go over 256 Threads (because some user on the mailing list stated that compojure (if I recall correctly) uses 256 threads)

For I7 (with 4 Cores + 4*HT)

Netty worker pool - 16 + X Threads (I think, not sure though)
Iteratee pool - 8 Threads
Play internal pool - 8 Threads
Default pool - 8 Threads
Database pool 96 Threads
DbContext pool 96 Threads

Total: ~232 Threads

@huntc

huntc commented Apr 6, 2013

Copy link
Copy Markdown
Contributor

Thanks @Skamander - I shall incorporate your recommendations in the next hour or two. Can we subsequently take this discussion to #96 - thanks.

msmith-techempower pushed a commit that referenced this pull request Jan 16, 2025
Brandon-Eilers added a commit to Brandon-Eilers/FrameworkBenchmarks that referenced this pull request Feb 11, 2025
... and shamelessly copied the dispatch settings from here:
TechEmpower/FrameworkBenchmarks#40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants