How to create a robot to test traffic on my site on localhost?

Asked

Viewed 80 times

1

I have a mysite.com site that is running in a local LEMP environment (Linux, Nginx, Mariadb, PHP7). The site is already ready and I have a database well loaded with many fake data.

Before sending to AWS-EC2, I want to test some accessibility parameters.

So I wanted to know how to create a robot that will simulate several concurrent accesses to my site.

I want to predict which limit of users accessing the system in which it starts to lose the expected income.

Any idea?

1 answer

1


How about using the Apachebench?

For example:

$ ab -n 100 -c 5 http://www.google.com/

-n: Specifies the number of HTTP requests.

-c: Indicates amount of simultaneous HTTP connections.

Exit:

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.google.com (be patient).....done


Server Software:        
Server Hostname:        www.google.com
Server Port:            80

Document Path:          /
Document Length:        260 bytes

Concurrency Level:      5
Time taken for tests:   1.217 seconds
Complete requests:      100
Failed requests:        87
   (Connect: 0, Receive: 0, Length: 87, Exceptions: 0)
Write errors:           0
Non-2xx responses:      100
Total transferred:      47848 bytes
HTML transferred:       26174 bytes
Requests per second:    82.18 [#/sec] (mean)
Time per request:       60.842 [ms] (mean)
Time per request:       12.168 [ms] (mean, across all concurrent requests)
Transfer rate:          38.40 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       24   28   2.9     28      39
Processing:    25   29   2.8     29      37
Waiting:       25   29   2.8     29      37
Total:         50   57   5.4     56      71

Percentage of the requests served within a certain time (ms)
  50%     56
  66%     59
  75%     61
  80%     62
  90%     65
  95%     67
  98%     71
  99%     71
 100%     71 (longest request)

I hope I’ve helped!

  • in the case of my site I have the first page - mysite.com with a login for the user to access the system. So this approach of yours tests only the first page? has how to test the internal pages?

  • 1

    In this case, the flag -C is able to pass a session cookie to the ApacheBech, enabling this type of test. Another tool that could help in this sense would be Jmeter.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.