File tree 3 files changed +89
-0
lines changed 3 files changed +89
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Setup
2
+
3
+ * Perl 5.10+
4
+ * MySQL 5.5
5
+ * Wrk 2.0
6
+
7
+ # Requirements
8
+
9
+ * Kelp
10
+ * DBD::mysql
11
+ * Starman (if using Starman as web server)
12
+ * Plack (for plackup)
13
+ * nginx (if you want to front Dancer with nginx, nginx.conf provided)
14
+
15
+ # Deployment
16
+
17
+ Something along the lines of
18
+
19
+ plackup -E production -s Starman --workers=2 -l /tmp/frameworks-benchmark.sock -a ./app.pl
20
+
21
+ if you want to front it with nginx, otherwise
22
+
23
+ plackup -E production -s Starman --port=8080 --workers=2 -a ./app.pl
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env perl
2
+ use Kelp::Less;
3
+ use DBI;
4
+
5
+ attr dbh => sub {
6
+ my $database = ' test' ;
7
+ my $host = ' ip-10-34-150-134.eu-west-1.compute.internal' ;
8
+ my $dsn = ' dbi:mysql:database=$database;host=$host;port=3306' ;
9
+ DBI-> connect ( $dsn , ' root' , ' ' , {} );
10
+ };
11
+
12
+ get ' /json' => sub {
13
+ { message => ' Hello, World!' }
14
+ };
15
+
16
+ get ' /db' => sub {
17
+ my $self = shift ;
18
+ my $queries = param-> {queries } || 1;
19
+ my @response ;
20
+ for ( 1 .. $queries ) {
21
+ my $id = int rand 10000 + 1;
22
+ if ( my $row = $self -> dbh-> quick_select( ' world' , { id => $id } ) ) {
23
+ push @response , { id => $id , randomNumber => $row -> {randomnumber } };
24
+ }
25
+ }
26
+ { \@response }
27
+ };
28
+
29
+ run;
Original file line number Diff line number Diff line change
1
+ user www;
2
+
3
+ worker_processes 2 ;
4
+
5
+ events {
6
+ worker_connections 1024 ;
7
+ }
8
+
9
+ http {
10
+ output_buffers 1 32k ;
11
+ postpone_output 1460;
12
+
13
+ sendfile on ;
14
+ tcp_nopush on ;
15
+
16
+ tcp_nodelay on ;
17
+
18
+ upstream backendurl {
19
+ server unix:/tmp/frameworks-benchmark.sock;
20
+ }
21
+
22
+ server {
23
+ listen 8888 ;
24
+ server_name localhost;
25
+
26
+ location / {
27
+ try_files $uri @proxy;
28
+ access_log off ;
29
+ expires max ;
30
+ }
31
+
32
+ location @proxy {
33
+ proxy_set_header Host $http_host ;
34
+ proxy_pass http://backendurl;
35
+ }
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments