Sails: startup profiling/performance tuning

Created on 10 Dec 2019  路  7Comments  路  Source: balderdashy/sails

Has anyone got any tips to share regarding the following?

  1. measuring which parts of sails are taking the longest during startup,
  2. specific issues/patterns to look out for which will slow startup,
  3. getting sails to start faster?
more info please performance postgresql question

Most helpful comment

@johnabrams7 yes, but I'm curious the difference it makes because:

I appreciate the burden of maintaining open source software, plus all the hard work that's gone into the Sails framework and supporting library, and I get the impression that support for these two packages is effectively on hold and they are already deprecated in favour of the impending sails-sql adapter (see various comments including https://github.com/balderdashy/sails/issues/6817#issuecomment-513333171, https://github.com/balderdashy/sails/issues/6820#issuecomment-515169117, https://github.com/balderdashy/sails/issues/6880#issuecomment-555219021, https://github.com/balderdashy/sails/issues/6888#issuecomment-555215340).

However, sails-sql still hasn't reached 1.0, hasn't had a public release for 9 months, and hasn't had a public commit since April 2019.

Is there anything I can do to help expedite PR review/merge or otherwise help with PosgreSQL support? If I were to submit a PR for updating the node-postgresql dependency for sails-postgresql, what is the chance of getting that released? Would it be more productive, and helpful to the community, if I were to actively support a PostgreSQL-focussed fork of sails-postgresql?

All 7 comments

@alxndrsn Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

  • look for a workaround. _(Even if it's just temporary, sharing your solution can save someone else a lot of time and effort.)_
  • tell us why this issue is important to you and your team. What are you trying to accomplish? _(Submissions with a little bit of human context tend to be easier to understand and faster to resolve.)_
  • make sure you've provided clear instructions on how to reproduce the bug from a clean install.
  • double-check that you've provided all of the requested version and dependency information. _(Some of this info might seem irrelevant at first, like which database adapter you're using, but we ask that you include it anyway. Oftentimes an issue is caused by a confluence of unexpected factors, and it can save everybody a ton of time to know all the details up front.)_
  • read the code of conduct.
  • if appropriate, ask your business to sponsor your issue. _(Open source is our passion, and our core maintainers volunteer many of their nights and weekends working on Sails. But you only get so many nights and weekends in life, and stuff gets done a lot faster when you can work on it during normal daylight hours.)_
  • let us know if you are using a 3rd party plugin; whether that's a database adapter, a non-standard view engine, or any other dependency maintained by someone other than our core team. _(Besides the name of the 3rd party package, it helps to include the exact version you're using. If you're unsure, check out this list of all the core packages we maintain.)_

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

@alxndrsn For faster startups or startup diagnostic, it's worth verifying/optimizing/cleaning-up the bootstrap, database configuration, and/or any custom modules added to the default set included with app. Upgrading database adapters or Sails itself when feasible may potentially improve startup performance as well.

As for specifically measuring startup performance, sails lift --verbose and sails lift --silly (even more detail) display various module startup times in milliseconds and the lift itself ultimately displays the completed startup timestamp for the entire app (in whole seconds).
Screen Shot 2019-12-16 at 6 32 58 PM
Great for profiling specific module startup times, however, the total app startup time isn't displayed as far as I know, but I can check with the team for any potential ways to extract that info.

I think there might be a way to tweak this further to display the start/end times in milliseconds with a console timelog script as another startup profiling technique. As for 3rd party tools, I'll keep an eye out and report back any significant ones for startup testing.

Here's a Gitter post by the founder covering further performance optimization philosophy for Sails - also related to database management. Scalability and reliability of the system / architecture hosting the app also play a role in startup performance (other side of the coin in comparison to code optimization).

Also found some additional Sails startup performance advice on Stackoverflow.

Hope this helps so far. I like the idea of having a total milliseconds of the app startup time show next to the lift timestamp -- e.g. debug: :: Mon Dec 16 2019 18:25:57 GMT-0600 (CST) (4230ms)

Upgrading database adapters or Sails itself when feasible may potentially improve startup performance as well.

Interesting point. Are you accepting patches for sails-postgresql/machinepack-postgresql? They currently depend on node-postgresql version 6.1.6, which is more than two years old.

@alxndrsn Sure, we can take a look at them - are they specifically to update node-postgresql?

@johnabrams7 yes, but I'm curious the difference it makes because:

I appreciate the burden of maintaining open source software, plus all the hard work that's gone into the Sails framework and supporting library, and I get the impression that support for these two packages is effectively on hold and they are already deprecated in favour of the impending sails-sql adapter (see various comments including https://github.com/balderdashy/sails/issues/6817#issuecomment-513333171, https://github.com/balderdashy/sails/issues/6820#issuecomment-515169117, https://github.com/balderdashy/sails/issues/6880#issuecomment-555219021, https://github.com/balderdashy/sails/issues/6888#issuecomment-555215340).

However, sails-sql still hasn't reached 1.0, hasn't had a public release for 9 months, and hasn't had a public commit since April 2019.

Is there anything I can do to help expedite PR review/merge or otherwise help with PosgreSQL support? If I were to submit a PR for updating the node-postgresql dependency for sails-postgresql, what is the chance of getting that released? Would it be more productive, and helpful to the community, if I were to actively support a PostgreSQL-focussed fork of sails-postgresql?

@alxndrsn Wanted to follow-up. How are you doing on the startup profiling/performance tuning for this one?

Some ideas for profiling SailsJS startup can be found at https://kevin.burke.dev/kevin/node-require-is-dog-slow/, but note that this blogpost is from 2015.

Was this page helpful?
0 / 5 - 0 ratings