Posts

Showing posts with the label performance

Digital Marketing

How to install New Relic Java agent to Glassfish

For Glassfish, you need to unpack newrelic.zip into your domain's directory, such as /opt/glassfish3/glassfish/domains/domain1/

How to Monitor Applications on the JVM

All Java processes can be monitored through a mechanism called JMX. System Administrators can enable remote authenticated JMX connections and see inside these running applications, rather than monitoring from the outside coming in. Monitoring applications with Mission Control / Flight Recorder Java Flight Recorder is an effective way of monitoring JVM applications in production. Unlike standard development profilers (like the NetBeans profiler), Flight Recorder has negligible performance impact. The dashboard view in Mission Control provides basic information about CPU and memory resources. Developers may use the Threads tab to better understand system throughput, or if the application is blocking around any particular resources. To open Mission Control, run the jmc command and connect to your Java application.

Using Staticaly CDN For Blogger Image

To use CDN Staticaly on blogger images is quite easy.  We just need to replace the https:// part of the image URL with https://cdn.staticaly.com/img/

Nagios XI default mornitor port 5666 and 5667

For Nagios XI to monitor remote Linux servers on default port, we need to open 5666 and 5667 in the to be monitored linux servers, for example: vi /etc/sysconfig/iptables - A RH - Firewall - 1 - INPUT - m state -- state NEW - m tcp - p tcp -- dport 5666 - s 192.168.3.75 - j ACCEPT - A RH - Firewall - 1 - INPUT - m state -- state NEW - m tcp - p tcp -- dport 5667 - s 192.168.3.75 - j ACCEPT 192.168.3.75 is your Nagios XI server

How to take a Thread Dump from a JVM

A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM). It is highly recommended to take more than 1 thread dump. A good practice is to take 8 thread dumps at a regular interval (eg. 1 thread dump every 8 seconds). How to get the PID of your java process Execute the following  to create a heap dump. jcmd [ PID ] GC . heap_dump [ PATH ] for example: jcmd 13898 GC . heap_dump / tmp / 13898.dump OR To get a thread stack dump with the concurrent locks : $ jcmd PID Thread . print - l for example: $ jcmd 13898 Thread . print - l | tee / tmp / 13898.thread . print . txt (jstack and jmap are unsupported and may or may not be available in future versions of the JDK.)

How to take a Thread Dump from a JVM

A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM). It is highly recommended to take more than 1 thread dump. A good practice is to take 8 thread dumps at a regular interval (eg. 1 thread dump every 8 seconds). How to get the PID of your java process Execute the following  to create a heap dump. jcmd [ PID ] GC . heap_dump [ PATH ] for example: jcmd 13898 GC . heap_dump / tmp / 13898.dump OR To get a thread stack dump with the concurrent locks : $ jcmd PID Thread . print - l for example: $ jcmd 13898 Thread . print - l | tee / tmp / 13898.thread . print . txt (jstack and jmap are unsupported and may or may not be available in future versions of the JDK.)

How to configure the Nginx reverse proxy on AWS Elastic Beanstalk

AWS Elastic Beanstalk   simplify the process of configuring the Nginx reverse proxy that runs on the web tier. You can place annginx.conf file in the .ebextensions/nginx folder to override the Nginx configuration. You can also place configuration files in the .ebextensions/nginx/conf.d folder in order to have them included in the Nginx configuration provided by the platform. .ebextensions/nginx/nginx.conf – Overrides the Nginx configuration for the platform. .ebextensions/nginx/conf.d – Files are included in the Nginx configuration provided by the platform.  For more information, see  Configuring the Reverse Proxy .

Munin

Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to kill our performance?" problems. It is designed to be very plug and play. A default installation provides a lot of graphs with almost no work.

How to solve: Slow Ubuntu DNS name lookups / resolution

Edit your network connections either wired or wireless. edit -> IPV4 Settings Change the default "Automatic(DHCP)" to "Automatic(DHCP) Adresses only " And then add your DNS-Servers (separated by comma ). If you don't need to resolve Intranet addresses, a good option would be use Google public DNS : DNS servers:  8.8.8.8, 8.8.4.4 ,1.1.1.1,1.0.0.1 It becomes very fast after these changes.

Test the Load Time of a Web Page

Enter a URL to test the load time of that page, analyze it and find bottlenecks http://tools.pingdom.com/fpt https://developers.google.com/speed/pagespeed/insights/

Load Balancing Options: Nginx vs. HAProxy vs. AWS ELB

Algorithm Options HAProxy supports Round-Robin, Least Connection, Weighted and more. It has the most options. Nginx supports Round-Robin and Weighted only. AWS ELB only supports Round-Robin. Monitoring Nginx can be monitored by any log monitor, like Nagios. HAProxy includes a built-in log monitors like Nagios. AWS ELB is supported by CloudWatch . Performance ELB has the best performance. HAProxy is better with small load (less than 30 connections). Nginx is better with heavy load.

Load Balancing Options: Nginx vs. HAProxy vs. AWS ELB

Algorithm Options HAProxy supports Round-Robin, Least Connection, Weighted and more. It has the most options. Nginx supports Round-Robin and Weighted only. AWS ELB only supports Round-Robin. Monitoring Nginx can be monitored by any log monitor, like Nagios. HAProxy includes a built-in log monitors like Nagios. AWS ELB is supported by CloudWatch . Performance ELB has the best performance. HAProxy is better with small load (less than 30 connections). Nginx is better with heavy load.

What's the difference between Icinga and Nagios?

Icinga is unique as a monitoring system and an ambitious project. This can be seen in the major differences to Nagios in Icinga’s architecture, two web interfaces and reporting capabilities, features for easier addon development, as well as its open and transparent development style. Icinga 2: Concurrent to improving Icinga as a fork of Nagios, the Icinga Project is also actively developing Icinga 2. There are two development branches: Icinga 1 (Nagios fork) and Icinga 2 (Core framework replacement / Nagios rewrite).

How to minify Resources (HTML, CSS, and JavaScript) to improve web page speed

Minifying resources refers to eliminating unnecessary bytes, such as extra spaces, line breaks, and indentation. Compacting HTML, CSS, and JavaScript can speed up downloading, parsing, and execution time. In addition, for CSS and JavaScript, it is possible to further reduce the file size by renaming variable names as long as the HTML is updated appropriately to ensure the selectors continue working. You should minify your HTML, CSS, and Javascript. For minifying HTML, you can use PageSpeed Insights Chrome Extension to generate an optimized version of your HTML code. Run the analysis against your HTML page and browse to the 'Minify HTML' rule. Click on 'See optimized content' to get the optimized HTML code. For minifying CSS, you can try YUICompressor and cssmin.js . For minifying JavaScript, try the ClosureCompiler , JSMin or the YUICompressor . You can create a build process that uses these tools to minify and rename the development files and save them to a p...

How to minify Resources (HTML, CSS, and JavaScript) to improve web page speed

Minifying resources refers to eliminating unnecessary bytes, such as extra spaces, line breaks, and indentation. Compacting HTML, CSS, and JavaScript can speed up downloading, parsing, and execution time. In addition, for CSS and JavaScript, it is possible to further reduce the file size by renaming variable names as long as the HTML is updated appropriately to ensure the selectors continue working. You should minify your HTML, CSS, and Javascript. For minifying HTML, you can use PageSpeed Insights Chrome Extension to generate an optimized version of your HTML code. Run the analysis against your HTML page and browse to the 'Minify HTML' rule. Click on 'See optimized content' to get the optimized HTML code. For minifying CSS, you can try YUICompressor and cssmin.js . For minifying JavaScript, try the ClosureCompiler , JSMin or the YUICompressor . You can create a build process that uses these tools to minify and rename the development files and save them to a p...

Stress test MySQL with mysqlslap

Quick start, just run: $ mysqlslap --auto-generate-sql --concurrency=200 --number-of-queries=1000 You can see verbose output by adding  the -v switch to the mysqlslap command line (adding extra ‘v’s increases the verbosity level) You can force mysqlslap to run a particular test more than once by adding the –iterations switch to the command line. --iterations=8 To save the report for future comparison:  ./mysqlslap --auto-generate-sql --concurrency=1000 --number-of-queries=3888 --iterations=8 | tee /tmp/mysqlslap. ` date +%F ` .csv Benchmark         Average number of seconds to run all queries: 0.857 seconds         Minimum number of seconds to run all queries: 0.750 seconds         Maximum number of seconds to run all queries: 0.900 seconds         Number of clients running queries: 1000         Average number of queries per client: 3

JConsole - a monitoring tool that complies to the Java Management Extensions (JMX) specification

The JConsole graphical user interface uses the extensive instrumentation of the Java Virtual Machine (Java VM) to provide information about the performance and resource consumption of applications running on the Java platform. You start JConsole by typing the following command at the command line. % jconsole Once you have connected JConsole to an application, JConsole is composed of six tabs. Overview: Displays overview information about the Java VM and monitored values. Memory: Displays information about memory use. Threads: Displays information about thread use. Classes: Displays information about class loading. VM: Displays information about the Java VM. MBeans: Displays information about MBeans.

How to examine the performance behavior of AWS EFS file system

$ sudo fio --name=fio-efs --filesize=10G --filename=./efs/fio-efs-test.img --bs=1M --nrfiles=1 --direct=1 --sync=0 --rw=write --iodepth=200 --ioengine=libaio fio-efs: (g=0): rw=write, bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=200 fio-2.1.5 Starting 1 process fio-efs: Laying out IO file(s) (1 file(s) / 10240MB) Jobs: 1 (f=1): [W] [98.1% done] [0KB/0KB/0KB /s] [0/0/0 iops] [eta 00m:06s]       fio-efs: (groupid=0, jobs=1): err= 0: pid=8292: Wed Aug 16 18:21:06 2017   write: io=10240MB, bw=34459KB/s, iops=33, runt=304294msec     slat (usec): min=52, max=212, avg=87.60, stdev=13.28     clat (msec): min=38, max=26291, avg=5941.21, stdev=5225.86      lat (msec): min=38, max=26291, avg=5941.30, stdev=5225.86     clat percentiles (msec):      |   1.00th=[ 1123],   5.00th=[ 2089], 10.00th=[ 2114], 20.00th=[ 2212],      | 30.00th=[ 2311], 40.00th=[ 2442], 50.00th=[ 2704], 60.00th=[ 3097]...

Debug MySQL performance Script.sql

-- run as root TEE mysql_output . txt ; SELECT VERSION(); SELECT NOW(); SHOW GLOBAL VARIABLES; SHOW MASTER STATUS; SHOW SLAVE STATUS\G SHOW GLOBAL STATUS; SHOW FULL PROCESSLIST; SHOW ENGINE INNODB STATUS\G SHOW FULL PROCESSLIST; -- Info on transactions and locks SELECT r . trx_wait_started AS wait_started, TIMEDIFF(NOW(), r . trx_wait_started ) AS wait_age, rl . lock_table AS locked_table, rl . lock_index AS locked_index, rl . lock_type AS locked_type, r . trx_id AS waiting_trx_id, r . trx_mysql_thread_id AS waiting_pid, r . trx_query AS waiting_query, rl . lock_id AS waiting_lock_id, rl . lock_mode AS waiting_lock_mode, b . trx_id AS blocking_trx_id, b . trx_mysql_thread_id AS blocking_pid, b . trx_query AS blocking_query, bl . lock_id AS blocking_lock_id, bl . lock_mode AS blocking_lock_mode FROM information_schema . INNODB_LOCK_WAITS w INNER JOIN information_schema . INNODB_TRX b ON b . trx_id = w . blocking_trx_id INNER JOIN information_sch...

Debug MySQL performance Script.sql

-- run as root TEE mysql_output . txt ; SELECT VERSION(); SELECT NOW(); SHOW GLOBAL VARIABLES; SHOW MASTER STATUS; SHOW SLAVE STATUS\G SHOW GLOBAL STATUS; SHOW FULL PROCESSLIST; SHOW ENGINE INNODB STATUS\G SHOW FULL PROCESSLIST; -- Info on transactions and locks SELECT r . trx_wait_started AS wait_started, TIMEDIFF(NOW(), r . trx_wait_started ) AS wait_age, rl . lock_table AS locked_table, rl . lock_index AS locked_index, rl . lock_type AS locked_type, r . trx_id AS waiting_trx_id, r . trx_mysql_thread_id AS waiting_pid, r . trx_query AS waiting_query, rl . lock_id AS waiting_lock_id, rl . lock_mode AS waiting_lock_mode, b . trx_id AS blocking_trx_id, b . trx_mysql_thread_id AS blocking_pid, b . trx_query AS blocking_query, bl . lock_id AS blocking_lock_id, bl . lock_mode AS blocking_lock_mode FROM information_schema . INNODB_LOCK_WAITS w INNER JOIN information_schema . INNODB_TRX b ON b . trx_id = w . blocking_trx_id INNER JOIN information_sch...