Running codimd issues

My version of CodiMD is: 1.6

Hello,

For several projects in Colombia we have the following facility: https://docutopia.tupale.co
Sometimes when I try to log in I get the message: I’m busy right now, try again later.
I have codimd running using systemd as indicated in this document: https://demo.codimd.org/svq0JObCToqyt3ZBCZ58og#
I would like to run it using PM2 to give it more resources but I have not been able to get codimd to run it the same way using pm2. Since I don’t know how to allocate more resources using npm start, I don’t know if anyone has experience in this and can share something with me to solve this problem.

Thank you.

:wave: Welcome to the community!

This message usually indicates that CodiMD spends too much time processing data on the event loop. This can happen when your CPU is rather busy. If you see this too often and your CPU is not busy, consider increasing the threshold in your config.json using the tooBusyLag option.

You can find all details about it along with the default here: https://github.com/codimd/server/blob/master/docs/configuration-config-file.md

Hope that helps :slight_smile:

1 Like

Thanks. What value yo recommend? I have 8vCPU and 8GB of RAM and i have this message. And the cpu doesn’t seem to have any use.

Please note, that CodiMD is a NodeJS program which means it’s single threaded and doesn’t explicitly benefit from multi-core system. More important would be single-core performance.

I can’t give you a recommendation here, as it probably needs some tinkering. Maybe double it, maybe even triple it. In the best case the screen will just disappear, in the worst case editing will be a bit more stuck. It depends on many factors as your CPU clock speed, the architecture, IO can factor in, number of users, document size, how you serve your uploaded images, etc.

I’m sure you figure out a better value easily. :slight_smile:

I understand. Thank you very much.

This is why I would like to run it with PM2 because it can take advantage of pm2’s functions to create forks or multiple instances of node applications, but when I run it with pm2 the socketio breaks and writing to the application doesn’t work.

CodiMD is not made to be scaled like that. We keep state in the node process which can not easily be shared (such as currently connected users to a document, current state of the edited document, etc). Please don’t run multiple instances of the application as this will mess up your documents for sure.

Link seems to have changed: hedgedoc/docs/content/configuration.md at master · hedgedoc/hedgedoc · GitHub

While you can indeed browse the repository, you also could use the docs website over at https://docs.hedgedoc.org, which for example also includes search functionality.