- Identified system bottlenecks, modified system configurations, added an NGINX load balancer, cached the data, indexed relational keys, and horizontally scaled a heavily READ / GET backend to handle network requests and reduce latency for a 60 million records PostgreSQL database.
- Resulted in:
- Increased read throughput by 57%
- Reduced response times to an avarege of ~83ms for image retrieval operations while maintaining a 0% error rate for 1,750 requests per second, or ~105,000 requests per minute
- Stress test data in Loader.io: https://bit.ly/2HO2Szs
- Resulted in:
- Client Demo
- API Endpoints Documentations
- Installing Dependencies
- Getting Started
- Getting Deployed
- Database Schema Design
- PostgreSQL
- Cassandra
- Express.js
- React
- Node.js
- Styled Components
Other Tools: NGINIX, EC2, S3, Loader.io, New Relic, K6
- READ / GET:
/listings
- Path Parameter(s): none
Request Body:
None
Response object:
{
[
{
listingID: number,
title: string,
location: string,
description: string,
quote: string,
hostname: string,
rating: string,
guests: number,
bedrooms: number,
beds: number,
bathrooms: number,
superhost: boolean,
reviews: array,
gallery: object {
featured: array [],
rooms: [
{
name: string,
amenities: array [],
images: array [
object {
url: string,
comment: string
}
]
}
]
}
},
{
... second listing object
},
{
... third listing object
},
{
... so on
},
]
}
Sucess Status Code: 201
- Create / Post:
/listings
- Path Parameter(s): none
Request Body:
{
listingID: number,
title: string,
location: string,
description: string,
quote: string,
hostname: string,
rating: string,
guests: number,
bedrooms: number,
beds: number,
bathrooms: number,
superhost: boolean
}
Response Object:
{
listingId: number
}
Success Status Code: 201
- CREATE / POST:
/listings/:listingId/photos/
- Path Parameter(s):
:listingId
Request Body:
{
images: array []
}
Response Object:
Success Status Code: 200
- READ / GET:
/listings/:listingId
- Path Parameter(s): none
{
listingID: number,
title: string,
location: string,
description: string,
quote: string,
hostname: string,
rating: string,
guests: number,
bedrooms: number,
beds: number,
bathrooms: number,
superhost: boolean,
reviews: array [],
gallery: object {
featured: [],
rooms: [
{
name: string,
amenities: array [],
images: array [
object {
url: string,
comment: string
}
]
}
]
}
}
Response Object:
Success Status Code: 200
- UPDATE / PUT:
/listings/:listingId/photos/
- Path Parameter(s):
:listingId
Request Body:
{
url: string
}
Response Object:
Success Status Code: 201
- DELETE / DELETE
/listings/:listingId/photos/:photoId
- Path Parameter(s):
:listingId, :photoId
Request Body:
None
Request Object:
Sucess Status Code: 204
From within the root directory:
npm install
- Node 10.5.0
- npm 6.14.7
- MongoDB 4.2.8
From within the root directory:
To run dev environment/webpack
npm run build
To run server
npm start
To seed database
npm run seed
To run tests
npm run test
To get started with the Gallery Module, run http://localhost:3001/ on your local web browser.
CREATE SCHEMA gallery_service;
CREATE TABLE gallery_service.listings (
listing_id SERIAL PRIMARY KEY,
title varchar(55),
listing_name varchar(55),
rating varchar(4),
num_reviews smallint not null,
superhost boolean,
listing_location varchar(55),
hostname varchar(55),
host_avatar_url text,
share boolean,
save_feature boolean
);
CREATE TABLE gallery_service.feature_photos (
feature_photo_id SERIAL PRIMARY KEY,
listing_id integer not null references gallery_service.listings(listing_id),
photo_1_url text,
photo_2_url text
);
CREATE TABLE gallery_service.rooms (
room_id SERIAL PRIMARY KEY,
listing_id integer not null references gallery_service.listings(listing_id),
room_name varchar(55)
);
CREATE TABLE gallery_service.photos (
photo_id SERIAL PRIMARY KEY,
listing_id integer not null references gallery_service.listings(listing_id),
room_id integer not null references gallery_service.rooms(room_id),
photo_url text,
photo_caption varchar(500)
);
CREATE KEYSPACE gallery_service WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 } AND durable_writes = 'true';
USE gallery_service;
CREATE TABLE listings_by_id (
listing_id int,
listing_title text,
listing_name text,
listing_rating decimal,
num_reviews int,
superhost boolean,
listing_location text,
hostname text,
host_avatar_url text,
share boolean,
save_feature boolean,
PRIMARY KEY(listing_id)
);
CREATE TABLE feature_photos_by_listings_id (
listing_id int,
feature_photo_id int,
photo_1_url text,
photo_2_url text,
PRIMARY KEY(listing_id, feature_photo_id)
);
CREATE TABLE photos_by_listing_id (
listing_id int,
room_id int,
photo_id int,
room_name text,
photo_url text,
photo_caption text,
PRIMARY KEY(listing_id, room_id)
);