Git Product home page Git Product logo

pattern-predictive-caching's Introduction

Pattern: Predictive Caching

Quick Start

Download required data sources from Kaggle into the datasource/ directory and prepare the datasets for their usage. The required steps are described in the Datasources Readme file.

Build container images:
./gradlew clean build bootBuildImage
Provide read permissions to those files to anyone to allow access within container:
chmod -R g+r,o+r datasource/
chmod -R g+r,o+r news-db/
chmod -R g+r,o+r monitoring/
If you first want to pull all images, run the following command (not required):
docker-compose pull --ignore-pull-failures
Run demo environment:
docker-compose up -d
Wait until the user-interest-db-init has been completed:
docker ps -a --format 'table {{.Names}}\t{{.Status}}'
NAMES                         STATUS
interest-feed                 Up 16 seconds
user-interest-db-init         Exited (0) 10 seconds ago
news                          Up 11 seconds
prometheus                    Up 16 seconds
grafana                       Up 16 seconds
mariadb-prometheus-exporter   Up 16 seconds
news-db                       Up 17 seconds
user-interest-db              Up 16 seconds
redis-prometheus-exporter     Up 16 seconds
node_exporter                 Up 17 seconds
cadvisor                      Up 17 seconds

Hint: The setup only works with Docker and has only been tested on Linux.

Websites:

News Service

Test curl request to get recommended news:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8081/news/recommended?topics=HOME%20%26%20LIVING,COMEDY&fromDate=2013-07-29&untilDate=2013-08-05&limit=20'

Hint: In a previous version we used a POST request for the /recommendedNews endpoint to simplify specification of parameters. However, Http client-side cache is not possible for POST requests. Therefore, we switched to a GET request.

Test curl request to get latest news:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8081/news/latest?untilDate=2013-08-05&limit=3'

Interest Feed Service

Test curl request to get feed for a user:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8082/feed/mariameyer000?date=2013-08-05'
Test curl request to get usernames:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8082/usernames?limit=10'
Test curl request to get interests:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8082/interests?limit=10'
Test curl request to get interests by user:
curl -s -XGET -H "Accept: application/json" 'http://localhost:8082/interests/mariameyer000'

ToDos

  • ✓ Feed should always contain news (use latest feeds API)

  • ✓ API to show all users (and maybe their interests)

  • ✓ Benchmark app

  • ✓ Monitoring setup and metrics for CPU time, CPU usage and memory of services and dbs

  • ✓ Metrics for service and db internals like http connections, …​

  • ❏ UI for Feeds and Usernames

  • ❏ Implementation of simple Feed caching (enable via config)

    • ✓ Http client cache in Interest-Feed service for News service endpoints

    • ✓ Http client cache in Benchmark for Interest-Feed service endpoints

    • ❏ Redis client-side cache in Interest-Feed service

    • ❏ MariaDB client-side cache in News service

    • ❏ Http independent cache for Interest-Feed and News service

  • ❏ Monitoring for Watt and CO2e

  • ❏ Implementation of predictive caching

  • ❏ Setup for Kubernetes

  • ❏ Documentation with images

pattern-predictive-caching's People

Contributors

ueisele avatar nadjahagen avatar

Stargazers

Axel Loser avatar  avatar

Watchers

Dieter Baier avatar Tobias Schaefer avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.