WildFly Installation and Tuning
Posted by on 31 July 2014 01:54 PM
|
|||||
Applicable Plans - All Cloud Hosting PlansWildFly Installation and TuningOverviewNote - this is the WildFly installation and tuning guide. Information on how to deploy your WildFly applications is found in the WildFly Application Deployment User Guide. WildFly is the continuation of the open source JBoss Application Server (JBoss AS) project. The project was renamed by Red Hat in order to differentiate the open source JBoss AS project from the commercial Red Hat JBoss Middleware project. More information about WildFly can be found here - What Is WildFly? One of the main advantages of WildFly is the Undertow web server. Undertow was built to be fast, lightweight, and scalable to over a million connections. If you are deploying a high performance, single purpose application, Undertow is the best choice. More information about Undertow can be found here - Undertow Web Server. WildFly is a very complex and powerful application that is intended for advanced users who are deploying enterprise grade applications. Before deploying your applications with WildFly, make sure that you really need all the features that WildFly provides. To make the best use of WildFly you need to be experienced in Java application programming and deployment.
Installing WildFly Starting and Stopping WildFly WildFly Administration Console WildFly Application Deployment Tuning WildFly WildFly DeploymentThere are two operating modes for WildFly deployment: as a Standalone server, and as a Managed Domain
More information about WildFly Operating Modes can be found here - WildFly Operating Modes. The default deployment approach for WildFly at eApps is to have Apache as the front-end for WildFly and to use either mod_jk or mod_proxy_ajp to pass requests from the Apache web server to WildFly. This allows the Apache web server to serve static content and applications that require Apache (PHP or HTML applications), and the Undertow web server that is built-in to WildFly to serve JSPs and Servlets. If you do not need to serve PHP or HTML applications and want to maximize the performance of your WildFly server you can turn off and disable the Apache web server. This will allow you to configure the Virtual Server to pass all requests directly to the Undertow web server included with WildFly. Information on how to deploy your applications is covered in the WildFly Deployment User Guide. This User Guide explains how to deploy your applications with or without Apache, and also covers now to upload and deploy your WAR file from the WildFly Administration Console - User Guide: Application Deployment with WildFly operating in Standalone Mode Installing WildFlyPay careful attention to the resources allocated to the Virtual Server that will be used for WildFly deployment, especially the available RAM. WildFly can be very memory intensive, and a lack of resources is one of the main reasons for poor performance. For a small WildFly application, start with at least 1024 MB of RAM, and be prepared to scale upwards as necessary. For larger WildFly applications, start with at least 2048 MB of RAM, and again be ready to scale upwards if your traffic and resource needs demand it. There are two choices for installing WildFly:
For either installation choice, you will need to install either MySQL database server and MySQL JDBC Driver, MariaDB database server and MySQL JDBC Driver, or the PostreSQL database server and PostgreSQL JDBC Driver. Which database you choose will depend on your existing codebase and preferences, and also which template you are using. MariaDB is only available on CentOS 7 templates, MySQL and PostgreSQL can be installed on CentOS 6 or CentOS 7. See the user guides for each database for more information - Database User Guides. Installing WildFly using a Control PanelInstalling applications using the ISPmanager Control PanelIf you are using the ISPmanager Control Panel, you can install WildFly and related applications from there. NOTE - if your codebase requires Java SE 7, you can only install WildFly 8 or WildFly 9. WildFly 10 is not compatible with Java SE 7. Java SE 7 can be installed from the ISPmanager Control Panel.
Information on how to tell which version of ISPmanager you are using can be found here - ISPmanager versions Installing WildFly using the command lineYou can install WildFly and related applications from the command line of the Virtual Server. You will need to install Java SE 8 and several Java plugins first, and then install WildFly. All of this is done using yum. To install Java SE 8 and the related applications, use the [root@eapps-example ~]# yum install -y java-1.8.0-oracle java-1.8.0-oracle-plugin java-1.8.0-oracle-jdbc java-1.8.0-oracle-src java-1.8.0-oracle-devel java-1.8.0-oracle-javafx To install WildFly, use the [root@eapps-example ~]# yum install -y wildflyX If you are going to use the mod_jk approach for WildFly, you will need to install mod_jk using the [root@eapps-example ~]# yum install -y mod_jk If you are going to install your database from the command line, please see the specific user guide for that database:
If you are going to use the Standalone deployment with Apache and mod_jk or mod_proxy_ajp, you will also need to create a website in Apache.
Starting and Stopping WildFlyWildFly can be stopped, started or restarted from either the Control Panel or the command line of the server. Using the Control PanelUsing the ISPmanager Control PanelThe way to start, stop, and restart WildFly from ISPmanager will depend on which version of ISPmanager you are using.
Using the Command lineThis can be done by connecting to the command line of your VS using SSH. You will need to be the root user to run these commands. Starting WildFly
Restarting WildFly
WildFly Status
WildFly Administration ConsoleIn WildFly, the jmx-console and the web-console have been replaced with the WildFly Administration Console. The Administration Console is the root context for the default WildFly installation, and is available at http://eapps-example.com:8080 (substitute your own domain name or IP address for eapps-example.com). This takes you to the Welcome to WildFly page. ![]()
To access the Administration Console, click on the Administration Console link. You can also access the Administration Console directly by going to http://eapps-example.com:9990 (substitute your own domain name or IP address for eapps-example.com). To log in to the Administration Console, you will need to use the admin user and password. The admin user password is found in the Once you have the password, you can log in to the Administration console. ![]() More information on how to use the WildFly Administration Console to deploy your application can be found in the User Guide for deployment - WildFly User Guide: Deployment in Standalone Mode WildFly Application DeploymentWith WildFly you can deploy your applications with the Apache web server being used to serve PHP or HTML based content while the Undertow web server serves all JSPs and Servelets. If you are not using any HTML or PHP content, you can turn off the Apache Web Server and have the built-in Undertow web server serve all JSP and Servelet content. Information on how to deploy your applications is covered in the WildFly Deployment User Guide - User Guide: Application Deployment with WildFly Tuning WildFlySet the Java Heap correctlyJava Heap Settings - an overview
One of the most important parts of tuning WildFly for better performance is to optimize the Java Heap settings. The Java Heap size is the amount of memory allocated to the Java Virtual Machine (JVM). The heap is where Java objects live, and there must be enough memory allocated to the JVM to support the needs of the deployed WildFly applications. How to find the correct Java Heap settingsBy default WildFly is configured to have an Initial Java Heap Size of 512 MB, and a Maximum Java Heap Size of 512 MB. Depending on your application and configuration, you may need to adjust this value in order to correctly optimize WildFly. To find the correct heap size, you will have to stop WildFly, and use the Linux The following must be done from the command line of the VS, with the WildFly service stopped. See the SSH user guide for more information if needed. [root@eapps-example ]# free -m In this example, with WildFly stopped, the operating system and all other applications and services running consume 1030 MB of RAM. Multiply this value by two giving a total of 2060, and subtract that from the total available RAM for a value of 2036 MB for the maximum heap. Remember, this is just a rough estimate. You may find that you need to adjust this number up or down as necessary, depending on how your application is configured and what other services your system is running. Generally, the maximum heap size should be just under half the amount of memory available. You can of course adjust this value higher or lower, but you may have to experiment to determine the true optimum heap size If your JVM runs out of heap space, the message java.lang.OutOfMemoryError may appear in the /var/log/wildflyX/standalone file. This message lets you know that you need to either adjust your heap settings, consider upgrading your plan, or optimize your application to use less memory and resources. You can also use the same Adjusting the Java Heap settingsTo set the Java Heap for WildFly you must modify the wrapper.java.initmemory and the wrapper.java.maxmemory settings in your /etc/wildflyX/wildfly.conf file. It is best to set the init parameter lower than the maximum parameter to ensure that Java does not initialize more memory than is actually needed. This will optimize memory for non-Java processes. The following must be done from the command line of the VS as the root user. See the SSH User Guide for more information if needed. [root@eapps-example ]# cd /etc/wildflyX Using a text editor (in this example the vim editor), edit the wildfly.conf file and change the settings below to your desired heap size values. The default values for the Java Heap Size are 512 MB for Initial and 512 MB for Maximum. This is the same no matter which offering you have. You will generally need to adjust the wrapper.java.maxmemory upwards, and leave the wrapper.java.initmemory as is. # Initial Java Heap Size (in MB) Make whatever changes are needed, and then save and exit the wildfly.conf file. You will need to restart WildFly for the new Heap settings to take effect. | |||||
|
Question, is there a maximum for the Xmx parameter for initializing Wildfly?
Thanks.
We apologize for our late reply to this, there is no maximum number, this will be limited by your resources, we do not recommend going beyond 60% of your installed memory for wildfly, and for the initializing value, we would recommend a value between 15-20%.
If you have any further questions please let us know. Also you can always contact us directly at support@eapps.com