-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d019748
commit ff4d9f1
Showing
11 changed files
with
540 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org/' | ||
|
||
ruby '~> 3.3' | ||
|
||
gem 'puma', git: 'https://github.com/dsalahutdinov/puma.git', branch: :add_preprocess_time | ||
gem 'rack' | ||
gem 'rackup' | ||
gem 'yabeda-prometheus-mmap' | ||
gem 'yabeda-puma-plugin', path: '/yabeda-puma-plugin' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Navigate to experiments directory: | ||
```sh | ||
cd experiments | ||
``` | ||
|
||
Setup environment | ||
```sh | ||
docker-compose run app bundle | ||
|
||
docker-compose up grafana promethes app | ||
``` | ||
|
||
To run stress-test: | ||
|
||
```sh | ||
docker-compose run k6 | ||
``` | ||
|
||
Navagate to grafana http://localhost:3000 to "Puma experimental" dashboard. | ||
|
||
See results: | ||
|
||
![Results](docs/puma-requests_wait_time.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'rack' | ||
|
||
run do |_env| | ||
# do some hard work | ||
number = (0..9_999_990).to_a.map { |i| i * 2 }.sum | ||
|
||
[200, {}, ["Result #{number}"]] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
x-app-resources: &x-app-resources | ||
deploy: | ||
resources: | ||
reservations: | ||
cpus: '1' | ||
memory: 512M | ||
limits: | ||
cpus: '1' | ||
memory: 512M | ||
|
||
x-app-service-template: &ruby-app | ||
image: ruby:3.3 | ||
environment: | ||
HISTFILE: /app/tmp/.bash_history | ||
BUNDLE_PATH: /usr/local/bundle | ||
BUNDLE_CONFIG: /app/.bundle/config | ||
prometheus_multiproc_dir: /tmp | ||
stdin_open: true | ||
tty: true | ||
working_dir: /app | ||
# tmpfs: | ||
# - /tmp | ||
|
||
services: | ||
app: | ||
<<: | ||
- *ruby-app | ||
- *x-app-resources | ||
command: bundle exec puma -t 16 -w 4 -C puma.rb | ||
volumes: | ||
- bundler_data:/usr/local/bundle | ||
- .:/app:cached | ||
- ..:/yabeda-puma-plugin | ||
|
||
k6: | ||
image: grafana/k6 | ||
command: run /app/k6.js | ||
profiles: [manual-run] | ||
volumes: | ||
- .:/app:cached | ||
sysctls: | ||
- net.ipv4.tcp_tw_reuse=1 | ||
|
||
prometheus: | ||
image: prom/prometheus:v2.17.1 | ||
container_name: prometheus | ||
volumes: | ||
- ./prometheus:/etc/prometheus | ||
- prometheus_data:/prometheus | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
- '--storage.tsdb.path=/prometheus' | ||
- '--web.console.libraries=/etc/prometheus/console_libraries' | ||
- '--web.console.templates=/etc/prometheus/consoles' | ||
- '--storage.tsdb.retention.time=200h' | ||
- '--web.enable-lifecycle' | ||
restart: unless-stopped | ||
expose: | ||
- 9090 | ||
depends_on: | ||
- app | ||
|
||
grafana: | ||
image: grafana/grafana:11.2.2-security-01 | ||
container_name: grafana | ||
volumes: | ||
- grafana_data:/var/lib/grafana | ||
- ./grafana/provisioning:/etc/grafana/provisioning | ||
environment: | ||
- GF_SECURITY_ADMIN_USER=admin | ||
- GF_SECURITY_ADMIN_PASSWORD=password | ||
- GF_USERS_ALLOW_SIGN_UP=false | ||
restart: unless-stopped | ||
expose: | ||
- 3000 | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- prometheus | ||
|
||
volumes: | ||
bundler_data: | ||
prometheus_data: | ||
grafana_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: 1 | ||
|
||
providers: | ||
- name: 'Prometheus' | ||
orgId: 1 | ||
folder: '' | ||
type: file | ||
disableDeletion: false | ||
editable: true | ||
allowUiUpdates: true | ||
options: | ||
path: /etc/grafana/provisioning/dashboards |
Oops, something went wrong.