SmartHypercube / autothrottle-social-network-src

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Social Network Microservices (for Autothrottle)

This is a fork of the Social Network Microservices published by Sinan. We made some modifications for Autothrottle. The Sinan's version is in turn forked from DeathStarBench, with 2 additional ML services added. Below is the original README from Sinan.

A social network with unidirectional follow relationships, implemented with loosely-coupled microservices, communicating with each other via Thrift RPCs.

Application Structure

Social Network Architecture

Supported actions:

  • Create text post (optional media: image, video, shortened URL, user tag)
  • Read post
  • Read entire user timeline
  • Receive recommendations on which users to follow
  • Search database for user or post
  • Register/Login using user credentials
  • Follow/Unfollow user

Pre-requirements

  • Docker
  • Docker-compose
  • Python 3.5+ (with asyncio and aiohttp)
  • libssl-dev (apt-get install libssl-dev)
  • libz-dev (apt-get install libz-dev)
  • luarocks (apt-get install luarocks)
  • luasocket (luarocks install luasocket)

Running the social network application

Before you start

  • Install Docker and Docker Compose.
  • Make sure the following ports are available: port 8080 for Nginx frontend, 8081 for media frontend and 16686 for Jaeger.

Start docker containers

Start docker containers by running docker-compose up -d. All images will be pulled from Docker Hub.

Register users and construct social graphs

Register users and construct social graph by running python3 scripts/init_social_graphs.py. This will initialize a social graph based on Reed98 Facebook Networks, with 962 users and 18.8K social graph edges.

Running HTTP workload generator

Make

cd wrk2
make

Compose posts

cd wrk2
./wrk -D exp -t <num-threads> -c <num-conns> -d <duration> -L -s ./scripts/social-network/compose-post.lua http://localhost:8080/wrk2-api/post/compose -R <reqs-per-sec>

Read home timelines

cd wrk2
./wrk -D exp -t <num-threads> -c <num-conns> -d <duration> -L -s ./scripts/social-network/read-home-timeline.lua http://localhost:8080/wrk2-api/home-timeline/read -R <reqs-per-sec>

Read user timelines

cd wrk2
./wrk -D exp -t <num-threads> -c <num-conns> -d <duration> -L -s ./scripts/social-network/read-user-timeline.lua http://localhost:8080/wrk2-api/user-timeline/read -R <reqs-per-sec>

View Jaeger traces

View Jaeger traces by accessing http://localhost:16686

Example of a Jaeger trace for a compose post request:

jaeger_example

Development Status

This application is still actively being developed, so keep an eye on the repo to stay up-to-date with recent changes.

Planned updates

  • Front-end design
  • Upgraded recommender
  • Upgraded search engine

About


Languages

Language:C 62.5%Language:Lua 16.3%Language:C++ 7.4%Language:HTML 5.6%Language:Python 3.5%Language:Assembly 2.1%Language:Makefile 0.7%Language:CMake 0.6%Language:Dockerfile 0.5%Language:Shell 0.2%Language:Batchfile 0.2%Language:CSS 0.2%Language:Thrift 0.2%Language:Roff 0.1%