GithubHelp home page GithubHelp logo

emphloyer-example's Introduction

Emphloyer example with PDO

This project is a simple test example that uses Emphloyer with PDO. You can use this to play around with it a bit.

Setup

The easiest way to get up and running is by using Vagrant.

If you cannot or do not want to use Vagrant you will need to ensure that you have MySQL running on localhost and that the database emphloyer_example exists.

Install the dependencies with composer with

composer install

Set the following environmental variables:

  • DB_USER to the MySQL user (set this to root when using the Vagrant box)
  • DB_PWD to the MySQL user password (set this to an empty string when using the Vagrant box)
  • REGULAR_WORKERS to the number of concurrent workers to run for jobs of types other than 'priority'
  • PRIORITY_WORKERS to the number of concurrent workers to run for jobs of the type 'priority'

With bash you would execute:

export DB_USER=username
export DB_PWD=password
export REGULAR_WORKERS=2
export PRIORITY_WORKERS=1

To initialize the test database run:

php init.php

The init script drops the test tables and then re-creates them. It then proceeds to insert 100 jobs, 90 with type 'regular' and 10 with type 'priority'. It also sets up the scheduler to insert one priority job every minute.

Running the example

To run the example simply run (from the project root):

vendor/bin/emphloyer -c config.php

Once the output stops Emphloyer has finished processing jobs.

The test jobs insert records into the things table, you can check how long the entire process took with:

select (max(created_at) - min(created_at)) as runtime from things;

emphloyer-example's People

Contributors

mrkcor 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.