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

Performance is not good enough to scale. #57

Open
ppepos opened this issue Aug 25, 2016 · 3 comments
Open

Performance is not good enough to scale. #57

ppepos opened this issue Aug 25, 2016 · 3 comments

Comments

@ppepos
Copy link
Collaborator

ppepos commented Aug 25, 2016

Currently:

  • Loading the homepage with under 10 players takes roughly 5 seconds.
  • Loading a player page takes roughly 3 seconds

Increasing the amount of players to say 60 renders the application unusable.

We need to start worrying about performance and fix some bottlenecks. After some discussion, here are some possible paths:

  • We tweaked the MongoDB connector to log each query and loading the homepage with 7 players triggers 821 queries to MongoDB. Most of which are pretty similar to each other.
  • Looking at the time passed in user vs kernel space might yield interesting information.
  • Profiling the app as it runs could also yield potential information.

Keep updating this issue with the information you gather so we can find appropriate fixes.

@Morriar
Copy link
Owner

Morriar commented Aug 25, 2016

Here's the bottleneck (and the source of all these queries): https://github.com/Morriar/Missions/blob/master/src/model/stats.nit#L33

@privat
Copy link
Collaborator

privat commented Aug 25, 2016

Here a callgrind of a single "/api/players" GET request on the web server:

callgrind.out.txt

conclusion: 2.57 GIr total
98.68% in Player::stats (7 calls)
63.03% in Repository:find (819 calls)
46% in BSON::to_json (1733 calls)

Code culprits:
48% in app
20% in boehm
15% in libbson (from mongo)
14% in libc (strlen and allocation)

@Morriar
Copy link
Owner

Morriar commented Sep 26, 2016

I will close #27 that is mostly about the same problem with less discussion in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants