Skip to content

Slow to start #247

@vjpr

Description

@vjpr

Takes about ~12 seconds to start (in Germany).

Connect assets is 6s, and then all the requires in api.js take a significant amount of time to start.

Possibly some apis are trying to make requests to the USA on startup.

What is the average startup time to expect?


Adding the following at the top of app.js and api.js...

var debug = require('debug')('test');
var req = require;
require = function(file) {
  debug("");
  var val = req(file);
  debug(file);
  return val;
};

...reveals the time required to parse/execute each required file:

  test connect-assets +369ms
  test  +0ms
  test ./controllers/home +1ms
  test  +0ms
  test ./controllers/user +219ms
  test  +0ms
  test  +6ms
  test ../config/secrets +1ms
  test  +0ms
  test ../models/User +0ms
  test  +0ms
  test querystring +0ms
  test  +1ms
  test validator +8ms
  test  +0ms
  test async +0ms
  test  +0ms
  test cheerio +270ms
  test  +1ms
  test request +263ms
  test  +0ms
  test fbgraph +304ms
  test  +1ms
  test lastfm +27ms
  test  +0ms
  test tumblr.js +71ms
  test  +0ms
  test node-foursquare +97ms
  test  +30ms
  test github-api +38ms
  test  +0ms
  test twit +21ms
  test  +0ms
  test ordrin-api +233ms
  test  +0ms
  test stripe +145ms
  test  +4ms
  test twilio +237ms
  test  +25ms
  test node-linkedin +32ms
  test  +316ms
  test clockwork +291ms
  test  +2ms
  test paypal-rest-sdk +65ms
  test  +1ms
  test lob +62ms
  test  +2ms
  test instagram-node +82ms
  test  +6ms
  test yui/yql +343ms
  test  +0ms
  test lodash +0ms
  test ./controllers/api +0ms
  test  +0ms
  test ./controllers/contact +3ms
  test  +0ms
  test ./config/secrets +0ms
  test  +0ms
  test ./config/passport +519ms
  express:application compile etag weak +0ms
  express:application compile query parser extended +2ms
  express:application compile trust proxy false +0ms
  express:application booting in development mode +1ms
  test  +24ms
  test connectAssets +6s
  test  +78ms
  test new MongoStore +16ms
  express:application  +6s
  express:application http.createServer +0ms
  express:application  +0ms
Express server listening on port 3000 in development mode
  test Total startup time +14ms 11953 ms

This is way to slow to iterate during a hackathon.

I think a remedy might be to require apis on demand instead of on startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions