Skip to content

Commit 56abaec

Browse files
committed
added RideSharingDesign design solution
1 parent 0dd7c50 commit 56abaec

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ The platform currently supports a total of 11 languages: C, C++, Java, Python, C
145145
- `ParkingLotDesign` - design of Parking Lot
146146
- `WhatsAppDesign` - design of messaging system like whatsApp / facebook messenger /weChat
147147
- `TwitterDesign` - design of messaging system with ability to follow and have timeline
148-
148+
- `RideSharingDesign` - design of car sharing system.
149149
# Codility.com tasks
150150
Codility is a platform for hiring stronger programmers faster. Has requirements for time and space complexity.
151151
Look for "codility" package
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package iurii.job.interview.design;
2+
3+
/**
4+
* Ride sharing service like Uber or Lyft
5+
* https://www.youtube.com/watch?v=J3DY3Te3A_A
6+
* Overview:
7+
* - Payment management
8+
* - Customer feedback gathering
9+
* Core features
10+
* - Finding and matching customers to drivers
11+
* - Mapping and routing ETA (estimated time of arrival)
12+
*
13+
* Bottom Up Approach - Storage - All trips - stores trips in multiple data centers and store to closest geo-located
14+
* If offline one data center, store to another. Availability is important. Eventual consistency.
15+
*
16+
* Low latency calls are needed. Uber - sql and non sql. Cassandra / MySQL
17+
* Store archive in Data Warehouse (Hadoop) to run more expensive queries. Business analytics
18+
*
19+
* Caching layer - in-memory database, to use for static data like maps, user data, but drivers positions are dynamic.
20+
*
21+
* Logging - which driver at which position, did what. As real time as possible.
22+
* From endpoints : customers or drivers: small messages about positions.
23+
* Cluster of Kafka servers is used to store the messages, ensure they are not lost and can be stream processed in real time
24+
* Kafka can use Hadoop to store/persist data.
25+
*
26+
* SOA - service oriented architecture
27+
* Provisioning services running - get software to newly running servers or containers. Ex. Terraform/Puppet/Docker - shielded containers,
28+
* that feels like separate host, but in fact many docker containers are running on the same linux machine
29+
*
30+
* Mesos/Kubernetes - container orchestration tool:
31+
* manages/coordinates collaboration between services. Manages life cycles of the services during runtime
32+
*
33+
* In order to connect client to particular service - network routing problem as efficient as possible
34+
* and routing mechanism should know the state of the services. Because such routing is difficult -
35+
* many services are designed stateless, so that it will not matter to which service client will be connected
36+
*
37+
* Testing:
38+
* - Unit test
39+
* - Distributed system with services linked and chained - resilience testing, in case part of system is not working.
40+
* Tool Hailstorm - goes to some services and puts them offline on some of group of hosts (shadow fleets),
41+
* that are on production but does not serve the customers. Log and observe, how system works.
42+
*
43+
* Graph problem (routing) city map to graph:
44+
* - route from driver to you
45+
* - route to destination
46+
* Shortest way from one node to another: speed allowance - weighted edges (can be precomputed)
47+
* ETA in real time (traffic information). Relying on historical data : past similar situations, fallback approach:
48+
* NP - complete (Dejkstra or A*) to calculate ETA with that - split city into smaller parts that are independent (not easy)
49+
* as possible and small graphs can be computed quickly.
50+
*/
51+
public interface RideSharingDesign {
52+
}

0 commit comments

Comments
 (0)