USStateDept / FPA_Core

The Core Application for the IRM Geo Development team for F/PA
GNU Affero General Public License v3.0
3 stars 7 forks source link

Test Initial Instance of NodeJS API implementation #340

Closed nathanhilbert closed 8 years ago

nathanhilbert commented 9 years ago

Most of the components of migrating the API to nodejs. Looks like @mdramos was right to think node as it cuts out a lot of the flask start up requirements when they aren't useful (see below for benchmark). This would definitely be a move to more of a microservice with pluses of isolation and minuses of more servers running.

Transactions:               3697 hits
Availability:             100.00 %
Elapsed time:              59.35 secs
Data transferred:         125.91 MB
Response time:              0.80 secs
Transaction rate:          62.29 trans/sec
Throughput:             2.12 MB/sec
Concurrency:               49.58
Successful transactions:        3697
Failed transactions:               0
Longest transaction:            4.03
Shortest transaction:           0.40

To do

nathanhilbert commented 9 years ago

with fetching dataset models and calculate clusters

Transactions:               2800 hits
Availability:             100.00 %
Elapsed time:              59.17 secs
Data transferred:          86.75 MB
Response time:              1.05 secs
Transaction rate:          47.32 trans/sec
Throughput:             1.47 MB/sec
Concurrency:               49.53
Successful transactions:        2800
Failed transactions:               0
Longest transaction:            3.99
Shortest transaction:           0.46
nathanhilbert commented 9 years ago

ready to test and merge.

backnotprop commented 9 years ago

Nice. I see you enable CORS for the front-end requests. How are you hosting the front-end at this point? I believe we should be able to direct users to the UI via node and not have to worry about CORS.

nathanhilbert commented 9 years ago

In production, all static files get diverted to CloudFront on AWS, so no flask server load there. Only the data-viz template is delivered and that has some server-side scripting that has to go through flask.
In production, the same can be done for the node api calls using haproxy as static files. Anything with url /api/5/slicer/* gets directed to the node application directly. In this case, there will be no problem with CORS since it will come to the same domain:port, but we can keep it in there for other devs who might be using the API in the future.

nathanhilbert commented 9 years ago

Curious if this is the route that we are taking? If so, I can continue to work on this branch by cutting out a lot of library imports to the flask application, which will speed that up as well.

backnotprop commented 9 years ago

@nathanhilbert Yes, this is the route we are taking