How to download Heap Dump from Apache2 web server?

We have provided ‘Download Heap Dump’ hyperlink in our heap dump analysis page. When a user clicks on this hyperlink, heap dump file will be downloaded from the ycrash application to the user’s local machine. Since heap dumps tend to be a very large file, it can clog the tomcat server in which ycrash is running. To circumvent this problem, a separate web server (Apache2, nginx,… )can be installed. This web server can be used only for downloading purposes.

In this article, we will be guiding through how to download heap dump from a separate web server.

Note: In this blog we are using Apache2 web server to download heap dump. We assume that you already have Apache2 running on your desktop or server. For more information on setting up Apache2 please read the following article: How to install and configure Apache2 on Ubuntu 16.04?

Step – 1: Configure virtual host in Apache2 web server

Read: How to create Apache2 virtual host

In ycrash we have launch-yc-server.sh file. We specify -DuploadDir system property which points to the directory where all yc server artifacts are stored. 

For example:

java -Xms2g -Xmx4g -DuploadDir=/opt/yc -jar webapp-runner-8.0.33.4.jar -AconnectionTimeout=3600000 --port 8080 yc.war &

Now this -DuploadDir directory should be specified as a root directory in your your-virtualhost-conf-file.conf file. Here is a sample of virtual host configuration:

<VirtualHost *:8090>
ServerAdmin webmaster@your-sever-name.com
ServerName your-sever-name.com
ServerAlias www.your-sever-name.com
 	DocumentRoot /opt/yc
	<Directory /opt/yc>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Require all granted
		allow from all
 	</Directory>
ErrorLog /opt/yc/error.log
 	CustomLog /opt/yc/access.log combined
</VirtualHost>

Step – 2: Configure YC server

In ycrash launch-uc-server.sh script you will need to add one more system property -DdownloadURLPrefix. This property should point to the URL of your web server. 

For example:

-DdownloadURLPrefix=https://www.your-server-name.com:8090

From this point whenever the user clicks on ‘Download heap dump’ hyperlink, it will be downloaded from the web server and not from the tomcat server in which the ycrash app is running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.

Up ↑

%d bloggers like this: