Skip to main content

Load testing API, LoadImpact, NewRelic, AWS computing, CPU credit, k6 cli...

https://github.com/loadimpact/k6

Price quite high but understandable compared to another service like BrowserStack, New Relic
https://loadimpact.com/pricing/#annually

Random pop out
https://www.techradar.com/news/captcha-if-you-can-how-youve-been-training-ai-for-years-without-realising-it

https://stackoverflow.com/questions/28984106/what-is-cpu-credit-balance-in-ec2

https://aws.amazon.com/ec2/instance-types/
Compared to DO
smallest 1GB memory, 1CPU (Xeon E520 ? 2.2GHz)

https://www.digitalocean.com/pricing/

k6 (loadimpact cli) seem not limit VUs (virtual user) since it run on client machine, use client resources. So cool. But with 1000 vus, even MBP 2017 seem lagging. Digital Ocean cheapest 5$ seem take a while to ready test with 100 vus

Auto restart
https://forums.aws.amazon.com/thread.jspa?threadID=165405
https://stackoverflow.com/questions/19835455/how-to-restart-node-application-automatically-on-aws-elastic-beanstalk/28986288
My bss suggest use /healthcheck, when it response other than 200 for example then re-init/restart instance ? So what with load balancer ?

virtual-host config or NGINX port for local/dev testing domain.
We can temporary use IP in serve Laravel or php -S (lumen from 5.2 remove serve by default)
php -S 178.122.23.111 -t ./public

remember add /index.php when call API served by php -S
May be php -S have options for auto-index.

https://easyengine.io/tutorials/monitoring/newrelic

With Apache ?
https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/apache-monitoring-integration
Too much config :-'

Lua doc loadimpact
https://loadimpact.com/load-script-api/

Appname Newrelic Beanstalk permanent.
https://stackoverflow.com/questions/49804240/set-newrelic-app-name-from-elb-env-variable-on-deploy

https://gist.github.com/obezuk/7a48ff8233a4aa2ec7dc7b986416647b

.ebextensions/newrelic.config

files:
 "/etc/php.d/newrelicappname.ini" :
  mode: "000644"
  owner: root
  group: root
  content: 'newrelic.appname="Application Name"'
packages:
 yum:
  newrelic-php5: []
  newrelic-sysmond: []
 rpm:
  newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
container_commands:
 newrelic1:
  command: "newrelic-install install"
 newrelic3:
  command: "/usr/sbin/nrsysmond-config --set license_key=$NR_INSTALL_KEY"
 newrelic4:
  command: "/etc/init.d/newrelic-sysmond start"

Some k6 samples
https://github.com/loadimpact/k6/tree/master/samples
Long example look to pantheon purchase test.
Threshold seems cool, can it used to test load without broke API ? For example if more than 5% of request lost/err then stop test ?

Running k6
https://docs.k6.io/docs/running-k6

https://www.mankier.com/1/siege
siege on ELB load balancer seems weird since ELB keep trying create new instance when one is down, too high load...

https://thehftguy.com/2016/10/03/haproxy-vs-nginx-why-you-should-never-use-nginx-for-load-balancing/
Worth a try to build EB stalk with nginx then compare performance / $.
may be CloudFront is good enough but I believe NGINX have something that continue grab apc share.

https://hypersense-software.com/2018/03/12/aws-elastic-beanstalk-nginx-php/


PaperTrail
https://raw.githubusercontent.com/papertrail/remote_syslog2/master/examples/remote_syslog.ebextensions.config
Oh thoughtwork
https://www.thoughtworks.com/mingle/infrastructure/2015/06/10/simple-solution-for-papertrail-on-elasticbeanstalk.html
https://github.com/aldogint/papertrail-laravel
https://forums.aws.amazon.com/message.jspa?messageID=662845

One of my aware is that sometime it seems eb deploy --staged not update change. May be I have to commit or add/staged something or clear cache ...

https://stackoverflow.com/questions/33884150/eb-deploy-staged-usage

https://github.com/moraes/config/issues/1
give a try eb abort  . May be it like k6, we can use it in different terminal tab. Remembering aptible tunnel connection.

Be careful with .yaml and/or .config
[space]. .. and/or tab can cause error.
With vim show number: $:set nu
Show tab character  $:set list
When have error => compare with default example/sample. For example if we have 2 space after first block then you should follow it. I have a couple of hours to figure out this.

2019-01-16 03:43:28    ERROR   The configuration file .ebextensions/04-papertrail.config in application version app-xxx-stage-190116_xxx contains invalid YAML or JSON. YAML exception: Invalid Yaml: while parsing a block mapping
 in "<reader>", line 14, column 3:
      "/etc/log_files.yml":
      ^
expected <block end>, but found BlockMappingStart
 in "<reader>", line 29, column 4:
       "/tmp/set-logger-hostname.sh":
       ^
, JSON exception: Invalid JSON: Unexpected character (#) at position 0.. Update the configuration file.
2019-01-16 03:43:28    ERROR   Failed to deploy application.

https://aws.amazon.com/elasticache/pricing/
https://aws.amazon.com/elasticloadbalancing/pricing/
https://12factor.net/

Determine gzip supported or not
$ curl http://example.com/ --silent --write-out "%{size_download}\n" --output /dev/null
31032
$ curl http://example.com/ --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null
2553

https://github.com/heroku/heroku-buildpack-php/blob/master/support/build/_conf/apache2/httpd.conf

Some load tester
https://geekflare.com/essential-tools-to-perform-stress-test-online/#Blazemeter
:oh blazemeter require JMeter test script. Try make some script in JMeter then export it.
Free seems only allow 50 users.

Error when deploy, this stuck have occur in Aptible too (rare but yes)
https://forums.aws.amazon.com/message.jspa?messageID=705572

2019-01-17 07:40:08    INFO    Environment health has transitioned from Info to Ok. Application update completed 87 seconds ago and took 24 seconds.
2019-01-17 07:42:08    WARN    Environment health has transitioned from Ok to Severe. None of the instances are sending data.
2019-01-17 07:46:16    INFO    Environment update is starting.
2019-01-17 07:46:20    INFO    Deploying new version to instance(s).
2019-01-17 07:53:23    WARN    User initiated abort was received, however the current step of the operation in progress is not cancellable. The current operation will be aborted as soon as the non-cancellable step(s) complete.
2019-01-17 08:00:23    WARN    The following instances have not responded in the allowed command timeout time (they might still finish eventually on their own): [i-xxxxxxxxx98a653a1].
2019-01-17 08:00:23    INFO    Command execution completed on all instances. Summary: [Successful: 0, TimedOut: 1].
2019-01-17 08:00:24    WARN    User initiated abort was received. Canceling the current operation.
2019-01-17 08:00:24    ERROR   Failed to deploy application.
2019-01-17 08:00:24    ERROR   During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

https://royal.pingdom.com/2018/08/15/can-gzip-compression-really-improve-web-performance/

Yeah
/etc/httpd/conf.d/aws_env.conf
[ec2-user@ip-xxx]$ php -i |grep "output_compression"
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1

/etc/httpd/conf.d/aws_env.conf:42:SetEnv PHP_ZLIB_OUTPUT_COMPRESSION "Off"
It config in beanstalk configuration screen.

https://geeksterminal.com/difference-between-mod-deflate-zlib-output-compression/981/
https://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/

https://stackoverflow.com/questions/42400648/aws-whats-the-best-scaling-trigger-for-php-server
https://blog.flux7.com/blogs/aws/must-know-facts-about-aws-elb
https://medium.com/stacktical/how-to-lose-money-with-the-new-aws-elb-network-load-balancer-e87e670c05ea

https://www.opcito.com/blogs/improve-your-load-balancer-performance-with-saltstack-and-nginx-2/

https://forums.aws.amazon.com/message.jspa?messageID=399607
https://sysdig.com/blog/amazon-elb-bug/

https://github.com/memcached/memcached/blob/master/doc/protocol.txt

NGINX tuning
https://gist.github.com/denji/8359866

k6 test stages, step by step increase vus to avoid kill server and may be trigger load balancer
https://github.com/loadimpact/k6/issues/550
http://users.cms.caltech.edu/~adamw/publications-openclosed.html

https://medium.com/nubego/understanding-aws-elastic-load-balancing-62bf3d2cec5f
https://www.webperformance.com/load-testing-tools/blog/2011/01/load-testing-back-to-basics-avoiding-the-keepalivetimeout-race-condition/

Alternative to NGINX + FPM custom on beanstalk.
http://www.mattzuba.com/2014/05/aws-elastic-beanstalk-with-apache-2-4-and-php-fpm-5-5/


https://bobcares.com/blog/apache-high-memory-usage/
What k6 run options for, find out here.
--vus virtual user, should be stages if want to avoid take down server
--duration 300s (s or m ? unit required)
--rqs limit req per s
--stage don't know how to use. => config in .js options stages = {...}
https://github.com/loadimpact/k6/blob/master/README.md

install k6 one paste
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
echo "deb https://dl.bintray.com/loadimpact/deb stable main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install k6

http://jestineyong.com/no-display-in-tv-due-to-eeprom-ic-fault/
CPU credit may be run out, so it seem staging down on same 70+ rps

https://forums.aws.amazon.com/thread.jspa?threadID=129400
https://www.webperformance.com/load-testing-tools/blog/2011/01/load-testing-back-to-basics-avoiding-the-keepalivetimeout-race-condition/

Comments

  1. The content you provided here is written clearly. The content of the information is very informative. Thank you for this excellent and good idea. keep blogging
    Google Cloud Platform Training
    GCP Online Training
    Google Cloud Platform Training In Hyderabad

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Rand mm 10

https://stackoverflow.com/questions/2447791/define-vs-const Oh const vs define, many time I got unexpected interview question. As this one, I do not know much or try to study this. My work flow, and I believe of many programmer is that search topic only when we have task or job to tackle. We ignore many 'basic', 'fundamental' documents, RTFM is boring. So I think it is a trade off between the two way of study language. And I think there are a bridge or balanced way to extract both advantage of two method. There are some huge issue with programmer like me that prevent we master some technique that take only little time if doing properly. For example, some Red Hat certificate program, lesson, course that I have learned during Collage gave our exceptional useful when it cover almost all topic while working with Linux. I remember it called something like RHEL (RedHat Enterprise Linux) Certificate... I think there are many tons of documents, guide n books about Linux bu

Martin Fowler - Software Architecture - Making Architecture matter

  https://martinfowler.com/architecture/ One can appreciate the point of this presentation when one's sense of code smell is trained, functional and utilized. Those controlling the budget as well as developer leads should understand the design stamina hypothesis, so that the appropriate focus and priority is given to internal quality - otherwise pay a high price soon. Andrew Farrell 8 months ago I love that he was able to give an important lesson on the “How?” of software architecture at the very end: delegate decisions to those with the time to focus on them. Very nice and straight-forward talk about the value of software architecture For me, architecture is the distribution of complexity in a system. And also, how subsystems communicate with each other. A battle between craftmanship and the economics and economics always win... https://hackernoon.com/applying-clean-architecture-on-web-application-with-modular-pattern-7b11f1b89011 1. Independent of Frameworks 2. Testable 3. Indepe