GithubHelp home page GithubHelp logo

caching's Introduction

caching

Source code examples and demo from Mark Richards microservices caching session at NFJS.

See the demo folder for a recording.

The presentation slides are available here.

environment setup

Run the RabbitMQ server:

docker run -p 5672:5672 -d --hostname my-rabbit --name some-rabbit rabbitmq:3

Initialize Queue

To setup all of the exchanges, queues, and bindings used by these examples, run the following:

./gradlew initQueue

Start the DataWriter

The DataWriter receives update requests over the datapump.q queue and simulates a slow operation such as writing to a backend data store.

./gradlew runDataWriter

Start multiple CustomerInfoService

CustomerInfoService consumes client requests to update the name. Each service instance listens for update events over the queue name.q. When an event occurs, an distributed in-memory cache is updated first. The hazlecast distributed in-memory cache updates the memory of the other service instances currently running. In addition, the name update is routed to the DataWriter for persistent storage over the datapump.q queue.

Open a new terminal and run the following to start the service and initialize the cache:

./gradlew runService --args load

Open two new terminals run the following in each:

./gradlew runService

Send Update Name Event

Run the following multiple times each with a different placeholder value for the argument:

./gradlew update --args <Name>

Diagnostics

The following command examines the queues inside the RabbitMQ server:

watch docker exec some-rabbit rabbitmqctl list_queues

caching's People

Contributors

pliesveld avatar wmr513 avatar

Watchers

 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.