Git Product home page Git Product logo

app-bank-offers's Introduction

VoltDB Bank Offers Example App

Use Case

Ingest generated consumer purchase transaction data and find the best matching offer to present to the consumer at the point of sale.

Matching offers are found using a query that joins a summary view of the account activity with this vendor (merchant) against the available offers from that vendor. The best match is determined by the priority for the offers that was set by the vendor.

The result is inserted into a persistent table, where it could drive a live web interaction, such as serving an online ad that describes the offer, retrieved from the inputs of the account and vendor_id. It is also shown in the web dashboard as recent examples of offers. This result is also inserted into an export table so that it can be pushed to Hadoop using the HTTP export connector.

The web dashboard shows recent offers as well as a moving chart of offers/sec and overall transactions/sec.

Code organization

The code is divided into projects:

  • "db": the database project, which contains the schema, stored procedures and other configurations that are compiled into a catalog and run in a VoltDB database.
  • "client": a java client that generates tick events and records performance metrics.
  • "web": a simple web server that provides the demo dashboard.

See below for instructions on running these applications. For any questions, please contact [email protected].

Pre-requisites

Before running these scripts you need to have VoltDB 4.0 or later installed. If you choose the .tar.gz file distribution, simply untar it to a directory such as your $HOME directory, then add the bin subdirectory to your PATH environment variable. For example:

export PATH="$PATH:$HOME/voltdb-ent-4.7/bin"

You may choose to add this to your .bashrc file.

If you installed the .deb or .rpm distribution, the binaries should already be in your PATH. To verify this, the following command should return a version number:

voltdb --version

Single Server Instructions

  1. Start the web server

    ./run.sh start_web

  2. Start the database server

    ./run.sh server

Optionally type Ctrl-C to close the tailing of the server log before proceeding, or open a new terminal in the same directory.

  1. Start the client

    ./run.sh client

  2. Open a web browser to http://hostname:8081

  3. To stop the demo:

Stop the client (if it hasn't already completed)

Ctrl-C

Stop the database

voltadmin shutdown

Stop the web server

./run.sh stop_web

Options

You can control various characteristics of the demo by modifying the parameters passed into the NbboBenchmark java application in the "client" function within the run.sh script.

Speed & Duration:

--duration=120                (benchmark duration in seconds)
--autotune=true               (true = ignore rate limit, run at max throughput until latency is impacted)
                              (false = run at the specified rate limit)
--ratelimit=20000             (when autotune=false, run up to this rate of requests/second)
--custcount=100000            (number of customers to pre-populate)
--vendorcount=5000            (number of vendors to pre-populate)

Instructions for running on a cluster

Before running this demo on a cluster, make the following changes:

  1. On each server, edit the run.sh file to set the HOST variable to the name of a selected server in the cluster:

    HOST=voltserver01

  2. On each server, edit db/deployment-cluster.xml to change hostcount to the actual number of servers (it is defaulted to 3):

  3. On each server, start the database. Start with the same server as "$HOST" that you set above, e.g. voltserver01

    ./run.sh cluster_server

On each of the servers you should see the following output:

Host id of this node is: 0

When all servers have joined the cluster and it becomes available you will see:

Server completed initialization.
  1. To run the client, edit the run.sh script on the server where you intend to run the client to set the SERVERS variable to a comma-separated list of the servers in the cluster (note: this could be a separate server or one of the servers in the cluster).

    SERVERS=voltserver01,voltserver02,voltserver03

  2. Run the client script:

    ./run.sh client

Instructions for exporting to CSV

  1. Edit the deployment.xml file to add the following. For an example, see the provided deployment-export-csv.xml file.
<export enabled="true" target="file">  
 <configuration>  
  <property name="type">csv</property>  
  <property name="nonce">MyExport</property>  
 </configuration>
</export>
  1. Then follow the instructions for running on a single server or cluster.

Instructions for exporting to Hadoop

  1. Edit the deployment.xml file to add the following. For an example, see the provided deployment-export-hadoop.xml file.
<export enabled="true" target="http">
 <configuration>
  <property name="endpoint">http://myhadoopsvr/webhdfs/v1.0/%t/data%p.%t.csv</property>
  <property name="batch.mode">true</property>
  <property name="period">120</property>
 </configuration>
</export>
  1. Then follow the instructions for running on a single server or cluster.

app-bank-offers's People

Contributors

benjaminballard avatar jhugg avatar

Watchers

Sid Sanyal 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.