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

Improve wekan performance #837

Closed
maulal opened this issue Feb 14, 2017 · 11 comments
Closed

Improve wekan performance #837

maulal opened this issue Feb 14, 2017 · 11 comments

Comments

@maulal
Copy link
Contributor

maulal commented Feb 14, 2017

Hi everybody :)
I will explain shortly what have been done to our wekan deployment to improve greetly the performance. But it should be good to do some work with the datamodel. I will try to add soon, a new issue for that.

Our wekan stats:
2222 users / 1516 boards / 10824 lists / 31854 cards / 23000 card_comment / 148000 activities

Our mongodb servers (1 mongodb replicaset of 3 nodes for High Availability): 2vcpu / 2Go 4GB RAM

On mongodb version: 3.2.x

With this configuration, we are always under 20% of cpu.

With the mongo shell, just connect to your mongod, and do:

use wekan
db.activities.createIndex({cardId:1, createdAt: -1})
db.activities.createIndex({boardId:1, createdAt: -1})
db.activities.createIndex({ commentId: 1 }, { partialFilterExpression: { commentId: { $exists: true } } })
db.activities.createIndex({ attachmentId: 1 },{ partialFilterExpression: { attachmentId: { $exists: true } } })
db.card_comments.createIndex({cardId:1, createdAt: -1})
db.cards.createIndex({boardId:1, createdAt: -1}) 
db.lists.createIndex({ boardId: 1 })
db.boards.createIndex({ "members.userId": 1 })
db.cfs.attachments.filerecord.createIndex({ cardId: 1 })
db.cfs.avatars.filerecord.createIndex({ userId: 1 })
db.presences.createIndex({ userId: 1 })
db.unsaved-edits.createIndex({ userId: 1 })

Maybe there are some indexes that are missing. But those in this issue, are the main one.

Bye ;)

@Nata-Jimi-Shekar
Copy link

@maulal these are pretty good numbers. BTW, what do you mean by 2Go Ram? Is it 2GB Ram. Are you using any cloud deployments or your in-house deployments?

So to get this numbers did you create indexes using the mongo shell on the production database without changing the indexes at the application level?

@maulal
Copy link
Contributor Author

maulal commented Feb 14, 2017

@nata-g sorry for my english... i did a mistake about unit (put it in french) and the value... after control, it's 4GB Ram but in fact it will work also with 2GB... (wekan database = 400MB)
It's an internal openstack deployment.

And yes, i create the indexes directly with the mongo shell... that's not the best idea, but sometimes it's better than nothing.

@fmonthel
Copy link
Contributor

Hi

I will have a look in the code to be sure to have this proper indexes cc @xet7 as I fixed one 4 months ago
Good figures, on my side we have 997 users and 20k live cards
Do you have only 1 nodejs instance ? (We have several with Haproxy docker compose lb)
Thanks

@xet7
Copy link
Member

xet7 commented Feb 17, 2017

@fmonthel

When I looked at Wekan code, some of those indexes @maulal mentioned have already been added. Can you add missing ones as pull request to devel branch?

@maulal
Copy link
Contributor Author

maulal commented Feb 17, 2017

@fmonthel we have a load balancer with 3 node.js in front of one mongodb replica set of 3 databases.

@xet7 No problem, i will do that tonight. I'm also actually looking on the meteor framework, to try to understand how it works, and how use it to improve the wekan performance regarding the database.

@xet7
Copy link
Member

xet7 commented Feb 17, 2017

@maulal

Thanks! Just recursive grep the code for word "ensureIndex" to see where it's set.

@fmonthel
Copy link
Contributor

fmonthel commented Feb 17, 2017 via email

@maulal
Copy link
Contributor Author

maulal commented Feb 18, 2017

@fmonthel Our wekan install is not in a docker environment. But today, if we have to do this kind of stuff, i should not put the mongodb database into docker (at least now), we think about it, but not before the release of the statefull set (kubernetes).

@xet7
Copy link
Member

xet7 commented Feb 19, 2017

Docker has volumes for persistent storage.

@maulal
Copy link
Contributor Author

maulal commented Feb 19, 2017

@xet7 Indeed persistent volumes is the right way to do this. But in fact, what should be the goal to put mongodb in a docker ?

  • availability is already given by mongodb (replica set) -> and you have to use swarm / kubernetes / etc...
  • performance should be at best equal or worst
  • easy to deploy, that's the only point i see with containers and mongodb
  • mutualize application server and/or database server

As i said, i look on docker with databases... but with some orchestrator tools. What should be the interrest of having a replica set on the same host => spof :'(

But if you really want something like that i can help.

@xet7
Copy link
Member

xet7 commented Feb 19, 2017

@maulal

Easy to test and deploy. Wekan was already using MongoDB in Docker when I came to project.

Plan is to add more deployment options.

There is already Wekan sharding in Docker to both MongoDB and ToroDB => PostgreSQL on:
https://github.com/wekan/wekan-postgresql

I probably try also using:

  • Wekan <=> ToroDB => PostgreSQL
  • Wekan <=> ToroDB server replication
  • Wekan <=> ToroDB => CochroachDB (instead of PostgreSQL, if it's useful)

Also on Joyent Triton there is datacenter full of Docker containers that can be resized without downtime in both RAM, CPU and disk space usage.
https://www.joyent.com/triton

xet7 pushed a commit that referenced this issue Feb 22, 2017
@xet7 xet7 closed this as completed in b185b5e Feb 22, 2017
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

No branches or pull requests

4 participants