- A scalable automobile rental web service Michael Zhang Sammy Guo - - PowerPoint PPT Presentation

a scalable automobile rental web service
SMART_READER_LITE
LIVE PREVIEW

- A scalable automobile rental web service Michael Zhang Sammy Guo - - PowerPoint PPT Presentation

- A scalable automobile rental web service Michael Zhang Sammy Guo Sujaya Maiyya Kyle Carson Justin Pearson CS 291A: Scalable Internet Services Prof Bryce Boe Fall 2017 University of California, Santa Barbara Outline App demo &


slide-1
SLIDE 1
  • A scalable automobile rental web service

Michael Zhang Sammy Guo Sujaya Maiyya Kyle Carson Justin Pearson CS 291A: Scalable Internet Services Prof Bryce Boe Fall 2017 University of California, Santa Barbara

slide-2
SLIDE 2

Outline

  • App demo & details
  • Tsung test setup
  • Optimizations

○ Horiz. & vertical scaling ○ Pagination & Caching ○ Concurrent Nginx connections

slide-3
SLIDE 3

Motivation

  • Sharing economy is efficient, environment-friendly and accessible to all.
  • A Uber or Lyft ride is not sufficient for all travelling demand, in case of

family trip, long journey or private event.

  • We are proposing a Uber-Lyft-like long-term car-sharing app.
  • Cheaper option for less-populated area
slide-4
SLIDE 4

Functionality

  • Car owners add their cars with make, model,

color, year and tags.

  • Car owners set parameters to renting their car,
  • start and end times
  • start and end locations
  • any additional terms they see fit
  • Car renters browse rentals with details, such as
  • wner info, car info, time duration and

geo-location on Google maps.

  • Car renters rent cars and monitor their progress.
slide-5
SLIDE 5

Implementation

  • Framework : Ruby on Rails
  • Database : sqlite3 in dev and postgreSQL in production
  • Gems : bcrypt, will_paginate, geocoder, byebug
  • Server : AWS Elastic Beanstalk
  • Continuous Integration : Travis
  • Load testing : Tsung
slide-6
SLIDE 6

App demo

https://safe-peak-44452.herokuapp.com/ http://luber.fun -- coming soon

slide-7
SLIDE 7

Data model

User User

  • wns

rents actions written to

Tags

sporty car seat sun roof

Log Rental Car

slide-8
SLIDE 8

Outline

  • App demo & details
  • Tsung test setup
  • Optimizations

○ Horiz. & vertical scaling ○ Pagination & Caching ○ Conncurrent Nginx connections

slide-9
SLIDE 9

Tsung tests: Workflow of a “Typical User”

slide-10
SLIDE 10

Tsung tests: Phases

Exponentially increase “new users spawned per sec” Sessions don’t overlap

slide-11
SLIDE 11

Tsung tests: Sessions

Idempotent & each user acts in isolation => avoids concurrency problems

slide-12
SLIDE 12

Tsung tests: Transaction

Users selected from CSV file Posting redirects; capture the redirect URL from the HTTP header Follow the redirect, then get the id

  • f the first editable car in the resulting HTML
slide-13
SLIDE 13

Tsung tests: simultaneous users

1 u/s 2 u/s 4 u/s 8 u/s 16 u/s # simult. users 60 sec Test time (sec) Tsung waits for all sessions to end before next phase 60 sec 60 sec 60 sec Theory: 60-sec phase + trailing session takes 6-8 sec => humps should be max 70 sec wide This graph: 100 sec wide? => long server resp times / errors (4xx’s & 5xx’s) => this particular hw configuration cannot support 4usr/sec

slide-14
SLIDE 14

Tsung tests: transaction time

Good Bad

Each tx has 1-sec think-time => 10-200ms “actual” waiting 2-8 sec for page load time taken for transaction (ms) Test time (sec) Test time (sec)

slide-15
SLIDE 15

Outline

  • App demo & details
  • Tsung test setup
  • Optimizations

○ Horiz. & vertical scaling ○ Pagination & Caching ○ Concurrent Nginx connections

slide-16
SLIDE 16
  • Horiz. & Vertical Scaling
slide-17
SLIDE 17

Cost analysis

(max user rate s.t. no 4xx or 5xx http codes in tsung.log)

slide-18
SLIDE 18

Pagination

For 2 users/sec Reduced 4xx/5xx server responses & page response times.

slide-19
SLIDE 19

Caching

  • Russian-doll caching on views
  • Only slight improvement; perhaps views not the bottleneck.
  • Should’ve cached db queries also
slide-20
SLIDE 20

Concurrent connections

  • AWS Elastic Beanstalk instances use Nginx web servers
  • Web servers can be one of the biggest bottlenecks for scaling an app
slide-21
SLIDE 21

Concurrent connections

slide-22
SLIDE 22

Concurrent connections: Solutions

  • Configure customized environment from project source by using

.ebextensions

  • Created a various configuration files in the .ebextensions directory and

ran redeployed eb instances

  • Manually logged into the instances, changed /etc/nginx/nginx.conf file

No method worked!

  • Did some Network Tier optimization (connection draining, stickiness, health

check..)

slide-23
SLIDE 23

Is it a good idea to use third party services for your application?

slide-24
SLIDE 24

Questions?