Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j14159/cowboy_pooler_example
A simple Erlang demonstration project using cowboy, pooler, and epgsql all setup by concrete.
https://github.com/j14159/cowboy_pooler_example
Last synced: 25 days ago
JSON representation
A simple Erlang demonstration project using cowboy, pooler, and epgsql all setup by concrete.
- Host: GitHub
- URL: https://github.com/j14159/cowboy_pooler_example
- Owner: j14159
- Created: 2014-11-20T22:31:09.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-20T22:37:28.000Z (about 10 years ago)
- Last Synced: 2024-10-29T21:14:30.286Z (2 months ago)
- Language: Makefile
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cowboy\_pooler\_example #
When faced with some pretty bizarre behaviour locally testing with [Tsung](http://tsung.erlang-projects.org/),
I went down the path of creating a simple application to test my approach in isolation. Turns out it
was mostly just a case of local -> VPN -> AWS causing me issues but I thought the resulting
simple application might serve as a useful example for others beginning with things like:* Opscode's great [concrete](https://github.com/opscode/concrete) tool
* the [Cowboy](http://ninenines.eu/docs/en/cowboy/1.0/guide/) application library
* Seth's [Pooler](https://github.com/seth/pooler) project for managing pools of connections, ````gen_server````s, etc
* the [Tsung](http://tsung.erlang-projects.org/) load testing tool (though my usage here is very simple)## What Is It? ##
It's a minimal example of a basic user service that has only a single ````GET```` endpoint.
## Building It ##
Pretty simple: ````make````
If you want to build a full release (a folder structure that includes the Erlang runtime, libraries, etc): ````make rel````
## Running It ##
The configuration targets PostgreSQL in a local [Vagrant](http://vagrantup.com) image, so start that first:
vagrant up
Make a release first by running ````make clean rel````. Starting it in the foreground:
./_rel/cowboy_pooler_example/bin/cowboy_pooler_example foreground
The basic endpoint to hit would be something like [http://localhost:8004/user/1](http://localhost:8004/user/1). Example
users 1-4 should be in the simple Vagrant-hosted database.## Using Tsung ##
As mentioned before, my usage is very basic. The supplied configuration file tries to simulate the arrival of 100 users per second.
Run it with the following command if you have the example service already running:tsung -f tsung.xml start
Once Tsung boots up, it will list the folder where it keeps its logs. I was originally using this to see the proportion of error 503
responses vs 200s under load and latency.