Does sailjs have some request throttling defaults?

284 views Asked by At

I've been working with Aurelia preview for a little while now mostly hosting my application locally using IIS. Someone suggested I take a look at sailsjs as an alternative way to get a project up and running quickly using nodejs. I've been enjoying that as well and have really appreciated how quickly it has been to get setup and have enjoyed exploring utilizing javascript for the front and backend.

Recently I tried to combine the two though and have been experiencing some issues. My first guess is that there is some default throttling on by default, but am unsure what the real problem is.

In IIS I have a project structure that looks like this:

Project
  build
  Config
  Controllers
  Models
  Views
  dist
  jspm_packages
  node_modules
  src
  styles
  test
  config files/package files/Global.asax

When I launch this project through IIS in Chrome, I see ~275 requests made for various js files that are loaded up by the starter kit project. Each request returns with the file in under ~50ms and the site loads fine.

In Sailsjs I have a project structure that looks like this:

Project
  api
  assets
    build
    dist
    jspm_packages
    node_modules
    src
    styles
    test
    config files/package files
  config
  node_modules
  tasks
  views
  other misc files setup by sails by default

When I perform sails lift through the command line on this project, #1 it takes a long time to launch(I believe because it is copying all of those files from assets into the .tmp directory it creates). Then when I browse to http://localhost:1337 in Chrome it also (eventually) makes ~275 requests for files. It seems to request ~195 files and receives 190 of them in ~380ms, but then it takes 2 minutes for the other 5 to return and then it requests the remaining ~80 files and returns those also in around ~300 ms.

So eventually the webpage loads, but it requires waiting around 2 min for it to do so.

Any idea as to why this would be happening or how I could start to locate the source of this issue?

UPDATE: I created a basic express project which just has a server.js file like this: var express = require('express'); var app = express(); app.use(express.static('dist')); app.listen(1337); All of the Aurelia files were placed in the dist directory. I ran this and all of the files seemed to be served without issue, so I'm led to believe the issue isn't with node or express, but I can't find where the issue is.

If anyone wants to reproduce this behavior locally, here are the steps to reproduce:

install node
use npm to install sails (npm -g install sails)
create a new sails project (sails new testAureliaProject)
delete everything in the assets directory
install gulp (npm install -g gulp)
install jspm (npm install -g jspm)
install aurelia-generator (npm install -g yo generator-aurelia)
generate aurelia skeleton project in assets directory(yo aurelia)
run gulp build in assets directory
run sails lift --verbose in testAureliaProject directory

Once you see the "Waiting..." in the command window open Chrome and navigate to http://localhost:1337 (and be prepared to wait)

0

There are 0 answers