Street Breasy Project Introduction
This repository contains the source for a single component of a real estate listing page built with a microservice architecture (SoA). The component is designed as a full stack service and includes a Node.Js API, a MongoDB database, a Nginx content-caching proxy and a Node.js load-balancer proxy. The API provides different image links to the client depending on a listing id number.
- Project subfolders
- Requirements and Dependencies
- Environment Setup
- API Documentation
- Back-end Performance Optimization
- Image Carousel Component API
- Load Balancer Proxy
- [NginX Content-Caching Proxy] (https://github.com/NCorreia100/Street-Breasy-Optimization/tree/master/nginx-proxy)
- Database Scripts
- This project makes use of the MapBox API to access static map images. To get an API key visit: https://www.mapbox.com/signup
- Node.js with Express.js web framework
- MongoDB database
- React front end framework
- Eric Meyer's CSS Reset
- Create a server instance to run the project
- On the remote server, allow traffic through TCP protocol on ports 22 and 80 for SSH and HTTP and ICMP (for ping)
- VPN to the remote server
- On the terminal, once at the desired directory, run the command
git clone https://github.com/HackberryPie/listing-page-load-balancer.git
followed bycd listing-page-load-balancer
. - Run the command
npm install
to download all required modules - On a different terminal window run the command
mongod --dbpath [path]
in which path refer to path to a directory of your choice as data storage - To start the server run the command
npm start
. - To make an API request, on your browser's address bar, enter your remote server's URL (or IP) followed by a single
/
and an interger between1
and10000000
- Optionally, you may use a tool to start the node server such as pm2 or docker.
- Optionally you may also select a different port to receive incoming HTTP requests. To do so, modify the value of
GATEWAY_PORT
. Default is80
.
The optimization goals for this project were as follows:
- Decrease latency for a complete page load to not exceed 1 second
- Increase server capacity to sustain at least 2'000 RPS (requests per second)
- Diminuish error rate (such as connection time out and port in use)
- Document metrics akin to each implementation
- Webpack to compress all code into a single file with the required modules
- Babel to transpile JSX code to JavaScript and eariler versions of JavaScript (such as ES6 and ECMAScript2018) to ES5
- Compression.js to apply gzip compression to reduce the response body size
- Morgan.js to log API requests and timing to complete the full request-response cycle
- Artillery.js for submiting large waves of requests (and get error rate)
- Newrelic.js to create reports on the performance of the server (latency and request-rate)
- Google's DevTools Performance Analyzer (page load performance)
##Optimization Metrics - https://docs.google.com/document/d/1vXppWpZGpDYjkNtJU35qRpkVJGpV_mEjU3HsvI0lV3M/edit