Giter VIP home page Giter VIP logo

latency-problems's Introduction

Latency problems

Motivation

Euler problems are an excellent source of Mathematical problems to improve your programming skills. The problems are able to be solved with multiple programming paradigms like Object Oriented, Functional or Reactive.

But in the implementation process, I missed that the problems don´t add any Latency factor to increase the complexity and this is part of the daily problems for every Software Engineer in the market.

Programming languages provide native solutions to manage latency. In Java, you can use CompletableFuture, in Kotlin you can use Coroutines, in Scala you can use Future, in Clojure you can use Future.

On top of the languages, exist libraries that improve the way to manage asynchronous calls and add Backpressure support for Reactive use cases. In Reactor you can use Mono or Flux objects, in RxJava, you can use Flowable

Finally, exist libraries that offer rich implementations of Reactive programming patterns. In Resilience4j, you could find solutions for: Circuit breaking, Rate limiting, Bulkheading, Automatic retrying

The purpose of this repository is the creation of a set problems adding the Latency as part of the problem to be solved in many different ways.

Enjoy the journey!

Juan Antonio Breña Moral

Problems

Problem 1

Feature: Consume some REST God Services

Background: Decimal representation of `Zeus` is 122101117115

Scenario: Consume the APIs in a Happy path scenario
    Given a list of REST API about Greek, Roman & Nordic
    When  call and retrieve all API info
    Then  filter by god starting with `n`
    And   convert the names into a decimal format
    And   sum

Scenario: Consume the APIs considering some latency in the greek service
    Given a list of REST API about Greek, Roman & Nordic
    When  call and retrieve all API info from the good list
    Then  filter by god starting with `n`
    And   convert the names into a decimal format
    And   sum

Notes:

Problem 2

Greek gods are quite popular and they have presence in Wikipedia, the multilingual online encyclopedia. If you try to find further information about Zeus you should visit the address: https://en.wikipedia.org/wiki/Zeus

Load the list of Greek Gods and discover what is the God with more literature described on Wikipedia.

Notes:

Problem 3

God fans are using a new API to provide information about GREEK, ROMAN or NORDIC gods. It is important that the interface support Concurrent access to the API. Provide a Test that ensure that in a Concurrent scenario, the information retrieved is Thread Safe.

Notes:

Problem 4

Given a set of providers to exchange money 
When  make the request to get the rate for the exchange 100 EUR into USD
Then  find the average rate from valid responses from the the providers

Notes: Review the timeout for Every connection. Money exchange providers:

Problem 5

Feature: Load Balancing

Scenario: Consume a REST Greek God Service
    Given a 5 instances of the same REST API about Greek gods
    When  the client sends the request
    And   execute a load balancing policy to distribute the traffic
    Then  return all gods starting with `a`

Notes:

Problem 6

Feature: Consume a REST Greek God Service

Scenario: Consume the API in a Happy path case
    Given a REST API about Greek gods
    When  the client sends the request
    And   execute a Retry Policy
    Then  return all gods starting with `a`

Scenario: Force an internal Retry behaviour
    Given a REST API about Greek gods
    When  the client sends the request
    And   execute a Retry Policy
    Then  return all gods starting with `a`

Scenario: Consume the API with a bad response
    Given a REST API about Greek gods
    When  the client sends the request
    And   execute a Retry Policy
    Then  return all gods starting with `a`

Scenario: Consume the API with a corrupted response
    Given a REST API about Greek gods
    When  the client sends the request
    And   execute a Retry Policy
    Then  return all gods starting with `a`

Scenario: Test a bad internal configuration
    Given a REST API about Greek gods
    When  the client sends the request
    And   execute a Retry Policy
    Then  return all gods starting with `a`

Notes:

Problem 7

Feature: Consume a REST Roman God Service

Scenario: Consume the API in a Happy path case
    Given a REST API about Roman gods
    When  the client sends the request
    And   execute a Circuit Breaker Policy
    Then  return all gods finishing the name with `s`

Scenario: Force an internal Circuit Breaker behaviour
    Given a REST API about Roman gods
    When  the client sends the request
    And   execute a Circuit Breaker Policy
    Then  return all gods finishing the name with `s`

Notes:

Problem 8

Feature: Consume a REST Indian God Service

Background:
A new REST API was deployed recently and the service 
doesn´t have the same capacity than other God Services.
It is necessary to protect the service with a rate limiter temporally
meanwhile the God Infrastructure is increasing the consumer capacity.

Scenario: Consume the API in a Happy path case
    Given a REST API about Indian gods
    When  the client sends the request
    And   execute a Rate limiter Policy
    Then  return all gods who contains in the name `a` & `i`

Scenario: Force a Rate limiter behaviour
    Given a REST API about Indian gods
    When  the client sends the request
    And   execute a Rate limiter Policy
    Then  return all gods who contains in the name `a` & `i`

Notes:

Problem 9

Feature: Consume a REST God Collector

Background:
The new REST God collector service has a high demand
and it is necessary to protect the internal subsystems from
high levels of concurrent traffic. 

Scenario: Consume the API in a Happy path case
    Given a REST API about God collector
    When  the client sends the request
    And   execute a Bulkhead Policy
    Then  return all gods

Scenario: Force a Bulkhead behaviour
    Given a REST API about God collector
    When  the client sends the request
    And   execute a Bulkhead Policy
    Then  return all gods

Notes:

Problem 9

Feature: Calculate the popularity of Indian gods in Mahabharata

Background:
The Mahabharata is one of the two major Sanskrit epics of ancient India 

Scenario: Calculate the influence of Indian gods in Mahabharata
    Given a REST API about Indian Gods
    When  the client sends the request
    Then  return the Top 3 indian gods mentioned in Mahabharata
    And   with presence in Wikipedia
    And   the number of hits in Mahabharata data source
       

latency-problems's People

Contributors

jabrena avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

latency-problems's Issues

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.