<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.open-xchange.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marens</id>
	<title>Open-Xchange - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.open-xchange.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marens"/>
	<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Special:Contributions/Marens"/>
	<updated>2026-06-30T23:21:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_Debian_12.0&amp;diff=28809</id>
		<title>AppSuite:Open-Xchange Installation Guide for Debian 12.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_Debian_12.0&amp;diff=28809"/>
		<updated>2024-09-06T16:22:55Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.6}}&lt;br /&gt;
&lt;br /&gt;
= OX App Suite on Debian GNU/Linux 12 =&lt;br /&gt;
&lt;br /&gt;
This article will guide you through the installation of OX App Suite, it describes the basic configuration and software requirements. As it is intended as a quick walk-through it assumes an existing installation of the operating system and requires average system administration skills. More, this guide will show you how to setup a basic installation with none of the typically used distributed environment settings. The objective of this guide is:&lt;br /&gt;
&lt;br /&gt;
* To setup a single server installation&lt;br /&gt;
* To setup a database for a single database service, no replication&lt;br /&gt;
* To setup a single Open-Xchange instance, no cluster&lt;br /&gt;
* To provide a basic configuration setup, no mailserver configuration&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
* Plain installed Debian GNU/Linux 12, no graphical tools required&lt;br /&gt;
* A supported Java Virtual Machine ([https://oxpedia.org/wiki/index.php?title=AppSuite:OX_System_Requirements#Server_Platforms learn more])&lt;br /&gt;
* A working internet connection&lt;br /&gt;
* vim is not installed by default on Debian. If you want to copy &amp;amp; paste the commands from this article into a shell window, you need to apt-get install vim first.&lt;br /&gt;
&lt;br /&gt;
= Database installation =&lt;br /&gt;
&lt;br /&gt;
Please consult our [[OXLoadBalancingClustering_Database#Standalone_database_setup|database installation instructions]] for information on how to install a database on the local system.&lt;br /&gt;
&lt;br /&gt;
Before proceeding, make sure the local machine has got a working MySQL service in one of the supported versions / flavors with the configuration / tunings applied as mentioned on our [[My.cnf|corresponding page]].&lt;br /&gt;
&lt;br /&gt;
= JRE Installation =&lt;br /&gt;
&lt;br /&gt;
Debian Bookworm ships with OpenJDK 17, which is not suitable for OX App Suite. It is therefore required to install Eclipse Temurin 8 JRE with HotSpot VM. A comprehensive installation guide can be found at https://adoptium.net/de/installation/linux/#_deb_installation_on_debian_or_ubuntu. Quick instructions are:&lt;br /&gt;
&lt;br /&gt;
 # install repo key&lt;br /&gt;
 $ apt install -y wget apt-transport-https gpg&lt;br /&gt;
 $ wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
 # add repository&lt;br /&gt;
 $ echo &amp;quot;deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main&amp;quot; | tee /etc/apt/sources.list.d/adoptium.list&lt;br /&gt;
&lt;br /&gt;
 # install jdk&lt;br /&gt;
 $ apt update # update if you haven't already&lt;br /&gt;
 $ apt install temurin-8-jdk&lt;br /&gt;
&lt;br /&gt;
= Add Open-Xchange Repository =&lt;br /&gt;
&lt;br /&gt;
Open-Xchange maintains public available software repositories for different platforms, such as Debian. This repository should be added to the Debian installation to enable simple installation and updates.&lt;br /&gt;
&lt;br /&gt;
Start a console and modify the Debian repository information file. Also add the Open-Xchange software repository:&lt;br /&gt;
&lt;br /&gt;
 $ cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/apt/sources.list.d/open-xchange.list&lt;br /&gt;
 &lt;br /&gt;
 deb https://software.open-xchange.com/products/appsuite/stable/appsuiteui/DebianBookworm/ /&lt;br /&gt;
 deb https://software.open-xchange.com/products/appsuite/stable/backend/DebianBookworm/ / &lt;br /&gt;
 &lt;br /&gt;
 # if you have a valid maintenance subscription, please uncomment the &lt;br /&gt;
 # following and add the ldb account data to the url so that the most recent&lt;br /&gt;
 # packages get installed&lt;br /&gt;
 # deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/DebianBookworm /&lt;br /&gt;
 # deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/DebianBookworm /&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
= Updating repositories and install packages =&lt;br /&gt;
&lt;br /&gt;
It is highly recommended to import the Open-Xchange build key to your package systems trusted keyring in order to make sure only Open-Xchange packages with valid signing are installed on the system. Otherwise you'll encounter warnings about untrusted package sources. To import the Open-Xchange buildkey, please refer to this quick guide: [[Importing_OX_Buildkey#Importing_key_into_apt_based_systems|Importing OX Buildkey]].&lt;br /&gt;
&lt;br /&gt;
Reload the package index. This will download the package descriptions available at the software repositories and will enable the Open-Xchange repository as a valid source for signed packages:&lt;br /&gt;
&lt;br /&gt;
 $ apt update&lt;br /&gt;
&lt;br /&gt;
The following command starts the download and installation process of all required package for Open-Xchange deployment:&lt;br /&gt;
&lt;br /&gt;
If you want to install everything on a single server, just run&lt;br /&gt;
&lt;br /&gt;
 $ apt install open-xchange open-xchange-authentication-database open-xchange-grizzly \&lt;br /&gt;
   open-xchange-admin open-xchange-appsuite \&lt;br /&gt;
   open-xchange-appsuite-backend open-xchange-appsuite-manifest&lt;br /&gt;
&lt;br /&gt;
'''Note 1:''' You have to choose between one of the available authentication packages depending on your requirements.&lt;br /&gt;
Open-Xchange configuration&lt;br /&gt;
&lt;br /&gt;
To avoid confusion right at the start notice that Open-Xchange uses multiple administration levels and requires different credentials at some stages at the installation and server management. Note that the passwords chosen at this guide are weak and should be replaced by stronger passwords.&lt;br /&gt;
&lt;br /&gt;
The MySQL database user&lt;br /&gt;
* Username: openexchange&lt;br /&gt;
* Password used at this guide: db_password&lt;br /&gt;
* Responsibility: Execute all kinds of database operations&lt;br /&gt;
&lt;br /&gt;
The Open-Xchange Admin Master&lt;br /&gt;
* Username: oxadminmaster&lt;br /&gt;
* Password used at this guide: admin_master_password&lt;br /&gt;
* Responsibility: Manage contexts, manage all kinds of low level server configuration&lt;br /&gt;
&lt;br /&gt;
The Context Admin&lt;br /&gt;
* Username: oxadmin&lt;br /&gt;
* Password used at this guide: admin_password&lt;br /&gt;
* Responsibility: Manage users/groups/resources inside a context&lt;br /&gt;
&lt;br /&gt;
As stated above we assume the MySQL service has been installed previously, and it is running and available.&lt;br /&gt;
&lt;br /&gt;
A good idea is to add the Open-Xchange binaries to PATH:&lt;br /&gt;
&lt;br /&gt;
 $  echo PATH=$PATH:/opt/open-xchange/sbin/ &amp;gt;&amp;gt; ~/.bashrc &amp;amp;&amp;amp; . ~/.bashrc&lt;br /&gt;
&lt;br /&gt;
Now we have to initialize the Open-Xchange configdb database. This can all be done by executing the initconfigdb script.&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/initconfigdb --configdb-pass=db_password -a --mysql-root-passwd=root_password&lt;br /&gt;
&lt;br /&gt;
Use the --mysql-root-passwd option to supply the MySQL root password as configured during database installation.&lt;br /&gt;
&lt;br /&gt;
Add the -i option if you want to remove an already existing open-xchange configdb.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' The -a parameter adds an openexchange account to MySQL. This account will be used for database connections from the OX App Suite middleware and requires [https://documentation.open-xchange.com/7.10.6/middleware/administration/db_user_privileges.html some privileges]. You can also create that account manually [https://oxpedia.org/wiki/index.php?title=OXLoadBalancingClustering_Database#Creating_Open-Xchange_user during database installation / configuration], in which case you can (should) skip the -a parameter here.&lt;br /&gt;
&lt;br /&gt;
Before starting any service, all basic configuration files need to be set up correctly. The --configdb-pass option indicates the password of the openexchange database user previously created, the --master-pass options specifies the password of the Open-Xchange adminmaster user that will be created when executing the oxinstaller script.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' You should have your Open-Xchange license code at hand. If you do not plan to license Open-Xchange, you can use the option --no-license instead. Please also check [https://documentation.open-xchange.com/7.10.6/middleware/miscellaneous/report_client.html OXReportClient] documentation for more information about configuring a supported and maintained Open-Xchange server.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' For MAX_MEMORY_FOR_JAVAVM a rule of thumb for simple installations is half available system memory. The value must be in MB. For example &amp;quot;1024&amp;quot; for 1GB .&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/oxinstaller --add-license=YOUR-OX-LICENSE-CODE \&lt;br /&gt;
 --servername=oxserver --configdb-pass=db_password \&lt;br /&gt;
 --master-pass=admin_master_password --network-listener-host=localhost --servermemory MAX_MEMORY_FOR_JAVAVM&lt;br /&gt;
&lt;br /&gt;
'''Note:''' In a clustered setup, --network-listener-host must be set to *&lt;br /&gt;
&lt;br /&gt;
Now is a good time to configure the way OX will authenticate to your mail server. Edit the file /opt/open-xchange/etc/mail.properties and change the com.openexchange.mail.loginSource to use. This is very important for servers that require your full email address to log in with.&lt;br /&gt;
&lt;br /&gt;
 # adjust com.openexchange.mail.loginSource&lt;br /&gt;
 $ vim /opt/open-xchange/etc/mail.properties&lt;br /&gt;
&lt;br /&gt;
After initializing the configuration, restart the Open-Xchange Administration service by executing:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl restart open-xchange&lt;br /&gt;
&lt;br /&gt;
Next we have to register the local server at the Open-Xchange configdb database:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerserver -n oxserver -A oxadminmaster -P admin_master_password&lt;br /&gt;
&lt;br /&gt;
Now we have to create a local directory that should be used as Open-Xchange filestore. This directory will contain all Infostore content and files attached to groupware objects. To maintain access by the Open-Xchange Groupware service, it is required to grant permissions to the open-xchange system user.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir /var/opt/filestore&lt;br /&gt;
 $ chown open-xchange:open-xchange /var/opt/filestore&lt;br /&gt;
&lt;br /&gt;
Now register the directory as a filestore at the Open-Xchange server:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerfilestore -A oxadminmaster -P admin_master_password \&lt;br /&gt;
 -t file:/var/opt/filestore -s 1000000&lt;br /&gt;
&lt;br /&gt;
'''Note:''' You might want to adapt the value provided with -s, the &amp;quot;The maximum size of the filestore in MB&amp;quot;, see registerfilestore --help.&lt;br /&gt;
&lt;br /&gt;
'''Note 2:''' If you are setting up OX App Suite, you need a shared filestore accross your OX servers even though you do not plan to have the OX Files feature enabled for your customers.&lt;br /&gt;
&lt;br /&gt;
Finally register the groupware database, this is a separated database where all groupware specific data is stored:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerdatabase -A oxadminmaster -P admin_master_password \&lt;br /&gt;
 -n oxdatabase -p db_password -m true&lt;br /&gt;
&lt;br /&gt;
'''Note 3:''' Take into account that a global database is needed in order to store data across context boundaries. Please see this [https://oxpedia.org/wiki/index.php?title=AppSuite:CrossContextDatabase documentation] on how to register it.&lt;br /&gt;
&lt;br /&gt;
= Configure services =&lt;br /&gt;
&lt;br /&gt;
Now as the Open-Xchange Server has been set up and the database is running, we have to configure the Apache webserver and the mod_proxy_http module to access the groupware frontend. &amp;lt;!-- To gain better GUI performance, the usage of mod_expires and mod_deflate is strongly recommended. Those modules will limit the amount of client requests and compress the delivered content. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ a2enmod proxy proxy_http proxy_balancer expires deflate headers rewrite mime setenvif lbmethod_byrequests&lt;br /&gt;
&lt;br /&gt;
Configure the mod_proxy_http module by creating a new Apache configuration file.&lt;br /&gt;
&lt;br /&gt;
 $ vim /etc/apache2/conf-available/proxy_http.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfModule mod_proxy_http.c&amp;gt;&lt;br /&gt;
    ProxyRequests Off&lt;br /&gt;
    ProxyStatus On&lt;br /&gt;
    # When enabled, this option will pass the Host: line from the incoming request to the proxied host.&lt;br /&gt;
    ProxyPreserveHost On&lt;br /&gt;
    # Please note that the servlet path to the soap API has changed:&lt;br /&gt;
    &amp;lt;Location /webservices&amp;gt;&lt;br /&gt;
        # restrict access to the soap provisioning API&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
        # you might add more ip addresses / networks here&lt;br /&gt;
        # Allow from 192.168 10 172.16&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # The old path is kept for compatibility reasons&lt;br /&gt;
    &amp;lt;Location /servlet/axis2/services&amp;gt;&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # Enable the balancer manager mentioned in&lt;br /&gt;
    # https://oxpedia.org/wiki/index.php?title=AppSuite:Running_a_cluster#Updating_a_Cluster&lt;br /&gt;
    &amp;lt;IfModule mod_status.c&amp;gt;&lt;br /&gt;
      &amp;lt;Location /balancer-manager&amp;gt;&lt;br /&gt;
        SetHandler balancer-manager&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
      &amp;lt;/Location&amp;gt; &lt;br /&gt;
    &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;Proxy balancer://oxcluster&amp;gt;&lt;br /&gt;
        Order deny,allow&lt;br /&gt;
        Allow from all&lt;br /&gt;
        # multiple server setups need to have the hostname inserted instead localhost&lt;br /&gt;
        BalancerMember http://localhost:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1&lt;br /&gt;
        # Enable and maybe add additional hosts running OX here&lt;br /&gt;
        # BalancerMember http://oxhost2:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP2&lt;br /&gt;
       ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
       SetEnv proxy-initial-not-pooled&lt;br /&gt;
       SetEnv proxy-sendchunked&lt;br /&gt;
    &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # The standalone documentconverter(s) within your setup (if installed)&lt;br /&gt;
    # Make sure to restrict access to backends only&lt;br /&gt;
    # See: https://httpd.apache.org/docs/$YOUR_VERSION/mod/mod_authz_host.html#allow for more infos&lt;br /&gt;
    #&amp;lt;Proxy balancer://oxcluster_docs&amp;gt;&lt;br /&gt;
    #    Order Deny,Allow&lt;br /&gt;
    #    Deny from all&lt;br /&gt;
    #    Allow from backend1IP&lt;br /&gt;
    #    BalancerMember http://converter_host:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 keepalive=On  route=APP3&lt;br /&gt;
    #    ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
    #       SetEnv proxy-initial-not-pooled&lt;br /&gt;
    #    SetEnv proxy-sendchunked&lt;br /&gt;
    #&amp;lt;/Proxy&amp;gt;&lt;br /&gt;
    # Define another Proxy Container with different timeout for the sync clients. Microsoft recommends a minimum value of 15 minutes.&lt;br /&gt;
    # Setting the value lower than the one defined as com.openexchange.usm.eas.ping.max_heartbeat in eas.properties will lead to connection&lt;br /&gt;
    # timeouts for clients.  See https://support.microsoft.com/?kbid=905013 for additional information.&lt;br /&gt;
    #&lt;br /&gt;
    # NOTE for Apache versions &amp;lt; 2.4:&lt;br /&gt;
    # When using a single node system or using BalancerMembers that are assigned to other balancers please add a second hostname for that&lt;br /&gt;
    # BalancerMember's IP so Apache can treat it as additional BalancerMember with a different timeout.&lt;br /&gt;
    #&lt;br /&gt;
    # Example from /etc/hosts: 127.0.0.1    localhost localhost_sync&lt;br /&gt;
    #&lt;br /&gt;
   # Alternatively select one or more hosts of your cluster to be restricted to handle only eas/usm requests&lt;br /&gt;
   &amp;lt;Proxy balancer://eas_oxcluster&amp;gt;&lt;br /&gt;
      Order deny,allow&lt;br /&gt;
      Allow from all&lt;br /&gt;
      # multiple server setups need to have the hostname inserted instead localhost&lt;br /&gt;
      BalancerMember http://localhost_sync:8009 timeout=1900 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1&lt;br /&gt;
      # Enable and maybe add additional hosts running OX here&lt;br /&gt;
      # BalancerMember http://oxhost2:8009 timeout=1900  smax=0 ttl=60 retry=60 loadfactor=50 route=APP2&lt;br /&gt;
      ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
      SetEnv proxy-initial-not-pooled&lt;br /&gt;
      SetEnv proxy-sendchunked&lt;br /&gt;
    &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
   # When specifying additional mappings via the ProxyPass directive be aware that the first matching rule wins. Overlapping urls of&lt;br /&gt;
   # mappings have to be ordered from longest URL to shortest URL.&lt;br /&gt;
   # &lt;br /&gt;
   # Example:&lt;br /&gt;
   #   ProxyPass /ajax      balancer://oxcluster_with_100s_timeout/ajax&lt;br /&gt;
   #   ProxyPass /ajax/test balancer://oxcluster_with_200s_timeout/ajax/test&lt;br /&gt;
   #&lt;br /&gt;
   # Requests to /ajax/test would have a timeout of 100s instead of 200s &lt;br /&gt;
   #   &lt;br /&gt;
   # See:&lt;br /&gt;
   # - https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass Ordering ProxyPass Directives&lt;br /&gt;
   # - https://httpd.apache.org/docs/current/mod/mod_proxy.html#workers Worker Sharing&lt;br /&gt;
   ProxyPass /ajax balancer://oxcluster/ajax&lt;br /&gt;
   ProxyPass /appsuite/api balancer://oxcluster/ajax&lt;br /&gt;
   ProxyPass /drive balancer://oxcluster/drive&lt;br /&gt;
   ProxyPass /infostore balancer://oxcluster/infostore&lt;br /&gt;
   ProxyPass /realtime balancer://oxcluster/realtime&lt;br /&gt;
   ProxyPass /servlet balancer://oxcluster/servlet&lt;br /&gt;
   ProxyPass /webservices balancer://oxcluster/webservices&lt;br /&gt;
 &lt;br /&gt;
   #ProxyPass /documentconverterws balancer://oxcluster_docs/documentconverterws&lt;br /&gt;
 &lt;br /&gt;
   ProxyPass /usm-json balancer://eas_oxcluster/usm-json&lt;br /&gt;
   ProxyPass /Microsoft-Server-ActiveSync balancer://eas_oxcluster/Microsoft-Server-ActiveSync&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modify the default website settings to display the Open-Xchange GUI&lt;br /&gt;
&lt;br /&gt;
 $ vim /etc/apache2/sites-enabled/000-default.conf&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin webmaster@localhost&lt;br /&gt;
 &lt;br /&gt;
        DocumentRoot /var/www/html&lt;br /&gt;
        &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
                Options -Indexes +FollowSymLinks +MultiViews&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
                RedirectMatch ^/$ /appsuite/&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
        &amp;lt;Directory /var/www/html/appsuite&amp;gt;&lt;br /&gt;
                Options None +SymLinksIfOwnerMatch&lt;br /&gt;
                AllowOverride Indexes FileInfo&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
 &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to secure your Apache setup via HTTPS (which is highly recommended) or if you have proxies in front of your Apache please follow the instructions at:&lt;br /&gt;
&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#.2Fopt.2Fopen-xchange.2Fetc.2Fserver.conf Grizzly configuration] in general, and specifically:&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#X-FORWARDED-PROTO_Header X-FORWARDED-PROTO Header]&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#X-FORWARDED-FOR_Header X-FORWARDED-FOR Header]&lt;br /&gt;
&lt;br /&gt;
to properly instruct the backend about the security status of the connection and the remote IP used to contact the backend.&lt;br /&gt;
&lt;br /&gt;
Enable the proxy configuration&lt;br /&gt;
&lt;br /&gt;
 $ a2enconf proxy_http.conf&lt;br /&gt;
&lt;br /&gt;
After the configuration is done, restart the Apache webserver&lt;br /&gt;
&lt;br /&gt;
 $ systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
== Apache Setting for more concurrent Connections ==&lt;br /&gt;
&lt;br /&gt;
By default apache2 is configured to support 150 concurrent connections. This forces all parallel requests beyond that limit to wait. Especially if, for example, active sync clients maintain a permanent connection for push events to arrive. The following article explains how that can be done&lt;br /&gt;
&lt;br /&gt;
[https://oxpedia.org/wiki/index.php?title=Tune_apache2_for_more_concurrent_connections Apache Setting for more concurrent Connections]&lt;br /&gt;
&lt;br /&gt;
= Creating contexts and users =&lt;br /&gt;
&lt;br /&gt;
Now as the whole setup is complete and you already should get a login screen when accessing the server with a webbrowser, we have to setup a context and a default user as the last step of this tutorial.&lt;br /&gt;
&lt;br /&gt;
The mapping defaultcontext will allow you to set this context as the default one of the entire system so that users which will be created within this context can login into Open-Xchange Server without specifying their domain at the login screen. Only one context can be specified as defaultcontext. The oxadmin user that will be created by this command is the default admin of the created context. This account will gather additional functions that are also described in the administration manual. The context id parameter must to be unique and numeric, otherwise the server will complain when you try to create a context. New contexts must be created by the oxadminmaster user, user accounts inside a context are created with the credentials of the contexts oxadmin account. The access-combination-name property defines the set of available modules and functions for users of the context.&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/createcontext -A oxadminmaster -P admin_master_password -c 1 \&lt;br /&gt;
 -u oxadmin -d &amp;quot;Context Admin&amp;quot; -g Admin -s User -p admin_password -L defaultcontext \&lt;br /&gt;
 -e oxadmin@example.com -q 1024 --access-combination-name=groupware_standard&lt;br /&gt;
&lt;br /&gt;
To create a user for testing purposes (Make sure the password you use here for the user is the same password as your email account or you will not be able to use the email module until it is set right):&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/createuser -c 1 -A oxadmin -P admin_password -u testuser \&lt;br /&gt;
 -d &amp;quot;Test User&amp;quot; -g Test -s User -p secret -e testuser@example.com \&lt;br /&gt;
 --imaplogin testuser --imapserver 127.0.0.1 --smtpserver 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
Now connect to the server with a webbrowser and login using the credentials testuser / secret.&lt;br /&gt;
&lt;br /&gt;
A complete overview about the different parameter is provided at the [https://oxpedia.org/wiki/index.php?title=OX_Permission_Level permission matrix].&lt;br /&gt;
&lt;br /&gt;
If you need to migrate a batch of users and contexts at once, check the CSV Batch Import documentation [https://oxpedia.org/wiki/index.php?title=Csv_import page].&lt;br /&gt;
&lt;br /&gt;
= Log files and issue tracking =&lt;br /&gt;
&lt;br /&gt;
== Default logging mechanism ==&lt;br /&gt;
&lt;br /&gt;
Whenever unexpected or erroneous behavior takes place, it will be logged depending on the configured loglevel. All logfiles are stored at the operating systems default location. Events triggered by the Open-Xchange Groupware services are logged to a rotating file open-xchange.log.0. Those files are the very first place to monitor.&lt;br /&gt;
&lt;br /&gt;
 $ tail -f -n200 /var/log/open-xchange/open-xchange.log.0&lt;br /&gt;
&lt;br /&gt;
== Alternative logging mechanisms ==&lt;br /&gt;
&lt;br /&gt;
Apart from the default file logging mechanism, Open-Xchange supports logging via logback framework and therefore via syslog and/or logstash. This makes it possible to directly log to a local or remote syslog daemon or other services. Logback is highly customizable, please see the documentation below.&lt;br /&gt;
&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:OX_Logging Logback configuration Guide OX App Suite]&lt;br /&gt;
&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Importing_OX_Buildkey&amp;diff=28808</id>
		<title>Importing OX Buildkey</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Importing_OX_Buildkey&amp;diff=28808"/>
		<updated>2024-09-06T16:12:09Z</updated>

		<summary type="html">&lt;p&gt;Marens: Debian 12 deprecated apt-key usage and can't work with pub files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__FORCETOC__ &lt;br /&gt;
&lt;br /&gt;
== Importing the Open-Xchange Buildkey ==&lt;br /&gt;
&lt;br /&gt;
Open-Xchange RPM packages are signed with the Open-Xchange build key and the APT repository is signed according to http://wiki.debian.org/SecureApt.&lt;br /&gt;
&lt;br /&gt;
 Key ID: DFD4BCF6&lt;br /&gt;
 Key fingerprint: 307D BCBD 75D2 B00E F81C  1E4C 1211 1537 DFD4 BCF6&lt;br /&gt;
&lt;br /&gt;
The public key can be downloaded from public PGP keyservers or from https://software.open-xchange.com/0xDFD4BCF6-oxbuildkey.pub&lt;br /&gt;
&lt;br /&gt;
Note that ''older'' releases have been signed using a different build key. You can download the public key to validate those packages here: https://software.open-xchange.com/0xEED949F0-oxbuildkey.pub&lt;br /&gt;
&lt;br /&gt;
=== Importing key into APT based systems ===&lt;br /&gt;
&lt;br /&gt;
==== From Debian 12 on ====&lt;br /&gt;
&lt;br /&gt;
To add the keyring file to your trusted keys directory&lt;br /&gt;
&lt;br /&gt;
 $ wget -qO - https://software.open-xchange.com/0xDFD4BCF6-oxbuildkey.pub | gpg --dearmor &amp;gt; /etc/apt/trusted.gpg.d/0xDFD4BCF6-oxbuildkey.gpg&lt;br /&gt;
&lt;br /&gt;
==== Up to Debian 11 ====&lt;br /&gt;
&lt;br /&gt;
To import the key into the APT keyring, run&lt;br /&gt;
&lt;br /&gt;
 $ wget https://software.open-xchange.com/0xDFD4BCF6-oxbuildkey.pub -O - | apt-key add -&lt;br /&gt;
&lt;br /&gt;
If this command returns &amp;quot;OK&amp;quot;, you're done importing the buildkey and can go on with the installation. In case that does not work, split it into two steps:&lt;br /&gt;
&lt;br /&gt;
 $ wget https://software.open-xchange.com/0xDFD4BCF6-oxbuildkey.pub&lt;br /&gt;
 $ apt-key add - &amp;lt; 0xDFD4BCF6-oxbuildkey.pub&lt;br /&gt;
&lt;br /&gt;
To verify the success, run&lt;br /&gt;
&lt;br /&gt;
 $ apt-key list&lt;br /&gt;
&lt;br /&gt;
The following or similar output should appear:&lt;br /&gt;
&lt;br /&gt;
 /etc/apt/trusted.gpg&lt;br /&gt;
 --------------------&lt;br /&gt;
 pub   rsa4096 2020-05-25 [SC]&lt;br /&gt;
       307D BCBD 75D2 B00E F81C  1E4C 1211 1537 DFD4 BCF6&lt;br /&gt;
 uid           [ unknown] Open-Xchange Release Team &amp;lt;release-team@open-xchange.com&amp;gt;&lt;br /&gt;
 sub   rsa4096 2020-05-25 [E]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Importing Key into RPM based systems ===&lt;br /&gt;
&lt;br /&gt;
To import that key into the RPM database, use the following command (as root):&lt;br /&gt;
&lt;br /&gt;
 $ rpm --import https://software.open-xchange.com/0xDFD4BCF6-oxbuildkey.pub&lt;br /&gt;
&lt;br /&gt;
to verify the success, use&lt;br /&gt;
&lt;br /&gt;
 $ rpm -qi gpg-pubkey&lt;br /&gt;
&lt;br /&gt;
that should give an output similar to this one:&lt;br /&gt;
&lt;br /&gt;
 Name        : gpg-pubkey&lt;br /&gt;
 Version     : dfd4bcf6&lt;br /&gt;
 Release     : 5ecb8c8f&lt;br /&gt;
 Architecture: (none)&lt;br /&gt;
 Install Date: Tue Feb  2 09:47:31 2021&lt;br /&gt;
 Group       : Public Keys&lt;br /&gt;
 Size        : 0&lt;br /&gt;
 License     : pubkey&lt;br /&gt;
 Signature   : (none)&lt;br /&gt;
 Source RPM  : (none)&lt;br /&gt;
 Build Date  : Mon May 25 11:14:55 2020&lt;br /&gt;
 Build Host  : localhost&lt;br /&gt;
 Relocations : (not relocatable)&lt;br /&gt;
 Packager    : Open-Xchange Release Team &amp;lt;release-team@open-xchange.com&amp;gt;&lt;br /&gt;
 Summary     : gpg(Open-Xchange Release Team &amp;lt;release-team@open-xchange.com&amp;gt;)&lt;br /&gt;
 Description :&lt;br /&gt;
&lt;br /&gt;
 -----BEGIN PGP PUBLIC KEY BLOCK-----&lt;br /&gt;
 Version: rpm-4.14.2 (NSS-3)&lt;br /&gt;
 &lt;br /&gt;
 xsFNBF7LjI8BEACi0I7wWTWa3mZUD28D3W+Gcb2xboEojBkLQXs3o9AELi2iz1Oz&lt;br /&gt;
 gmdWtmoNl83BUtMazKD3MJsPJ+uHCpoCGD10rSIMoMw5plLJ+zCfoPhDVAfulDVj&lt;br /&gt;
 3nIJnQXplZaPvOq1Z4ulWydfXOt3/X5M+bmFyDUfllIbWK07OEENR/IW4D6TPiNZ&lt;br /&gt;
 DtiZLnXWKQy3UJMOWTtzDyXJKCB7dp4pfMjtDnbHYClBrh0q1skXMWpKQBLC239U&lt;br /&gt;
 7ZAgs4UdyvABfGwLGfrPyz3H9nQGl/Olx6h+HOwvqTT/ucQwMgi7tpzlmAchlSd4&lt;br /&gt;
 fWQyXZO79RRJIyV3pD+lKr/1r0CZy6GqfslzikYJFNi+iZY0ru4QsqRmLUtrjIZ7&lt;br /&gt;
 al5zzJDYRpzd65J8G0gSWazz8C6QzNPw+36wDIF0jidWC3XQbkhsK6s1XlIbcwdS&lt;br /&gt;
 +5sYsR0ShWeRIvPNB4yeZJU+WqK9YHYvqRn19lCzH/36DiNVbcMDViyl864eHPcs&lt;br /&gt;
 zbIGAoPugEq6S0Ji/K+wlRFRdTATuwLt+WEaiOejynZ7+X9T1cptpOLV7ubz7SrX&lt;br /&gt;
 /JpBRy2tzwFaLZH2vsiWvinfb7/x0FVvhdjuEryou7plZSlQL8FI0TCg9VUYX/DE&lt;br /&gt;
 AHmx33hiDhVRuv3wSxxENvg3VbJf1PbQBlf7XP76MeFRhBlTXz3TsD1TlQARAQAB&lt;br /&gt;
 zTlPcGVuLVhjaGFuZ2UgUmVsZWFzZSBUZWFtIDxyZWxlYXNlLXRlYW1Ab3Blbi14&lt;br /&gt;
 Y2hhbmdlLmNvbT7CwY4EEwEIADgWIQQwfby9ddKwDvgcHkwSERU339S89gUCXsuM&lt;br /&gt;
 jwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRASERU339S89lwgD/9kaiGD&lt;br /&gt;
 crOjnBQd6OzaL0oSlePP6VWHxhSOoK3okHS6G3DJwdLxluhbCraYjFcquVE3QIS5&lt;br /&gt;
 krYusQ8VoQ8Sb+TQAE4ew8ILNgGMkV9veZ3EtvcwDOM5G3gEVzReJdBZP/bxxe25&lt;br /&gt;
 3Yq6V9b29ZuC5HEAzfcUspyMX3Uvwfiwub7uWxmmAKta6sH2aKZNNadcAAqwDnTQ&lt;br /&gt;
 YnBlq34UJFIc1YlHQ74cCRWsletfceqRgksh2Fa26B4+bnAFe+SySJ/QE4Xj8vH4&lt;br /&gt;
 +fht5VWyXFtHcIU6c/+TgdH5FTGze2Xv20drzMWPgcXBMEq2CTMw/G8y+BSTnuWm&lt;br /&gt;
 Vi02o5GLVfVcpOqNnDdpqWH562UaS75uKgjE1sv4VK/NqP+5jJkAvP2xmhjiqTEo&lt;br /&gt;
 Qidhz6/X/AYpJGer8JYtyepir/sRvTYOE9HmffV4ffXIJZ0FjNDR3HEeHjcxoPvh&lt;br /&gt;
 GpXG9khpFv9C7DjiCiahu79zYYp544mPF9mmU5onVYNTnDyGJjxDQqO0B51mzYZU&lt;br /&gt;
 qMMm98K6ZOpcpAwC/UV6ocMBH3/QD/gfpmnk4EfSPDUBMVbp/R1a4PsiKrRh2GQ6&lt;br /&gt;
 JS5EYRzdM/UfJuDy4wIov3dxJEjcx34ipiFTuYBGCFAnFcMD6uzcqKRytg8Tign9&lt;br /&gt;
 gMt8fJDawO2v9r+L/7WECfTXKdu4OAdOKM0eeM7BTQRey4yPARAAsR8AJ7EP7tnt&lt;br /&gt;
 j+t+LMJPfR3Q0WAv8kwE4jQsuxrGHAIqnlW6hFqFtahBxLFAmb6eaxiGQbeC2wDl&lt;br /&gt;
 noYYJh6gri6CkRUlW2QROIDmW8uoTMo6yjrO8l0TOlgI8m6vYcphPyueK6V2bx5O&lt;br /&gt;
 yI+YN4Np8qbcxtdYUQ4OH2lHcsWetUkL++NU1hmKTpcRGETCdCLy9AWare6x5m4p&lt;br /&gt;
 embPXYI43/9cyOO3jWSzLYRwFuoQ6dSxI1lwTCpHfsHuPesGSF//DzBBf5+maLO8&lt;br /&gt;
 786hVKrU1x7Ei2nq2HH5be9dNHOnIXQE/VweNEpoSQf7YMB1QouxTm4XqzLO/TEh&lt;br /&gt;
 /I/UELfNqCXxVAl5YDIehXpUj0dCT0NSRkYxbKCUkXmqxUo26cpXkdxSQyCykst/&lt;br /&gt;
 RR7wlhqUUM3cdQVsKSbm7ZD3s06bjCF3BPRCCCgSuBEcz/RHi9eLTXzV4VCmQZsD&lt;br /&gt;
 RU5pFVIG6JNgveZ6s2hlww0NwTj6RQL/dJrLV2egTAAg7KPWR+OI7UQO4cmgcOeU&lt;br /&gt;
 PQ6i8zcPeD7MX7cdo6P6xd5ohwaWvhd5reJvODMWVfchthELySq4rZpxph2dXMoU&lt;br /&gt;
 eNFgbO3iGqB4sT2+2UQV1JzVatBjfZpk2e4Kgl73vi7IPogN3ttqTc0m2gaCTRcp&lt;br /&gt;
 nS5Q6l548f9i3s8eFX5t911CxJHlBs8AEQEAAcLBdgQYAQgAIBYhBDB9vL110rAO&lt;br /&gt;
 +BweTBIRFTff1Lz2BQJey4yPAhsMAAoJEBIRFTff1Lz2NMAP/1CoAv6gDxhTdHtb&lt;br /&gt;
 56n5PsHrZ0hJ0ngWfXVe610GTasNZ3i2E4JRyIkpQjIJPdre3bP0g9fL7dvB7ByS&lt;br /&gt;
 JfEshLUFBYFxm3ds+q2aV7aOx6+9+7C3RLv+KVofB5V3qUsxXH3nhJWtL/JGhl/I&lt;br /&gt;
 1uQ7qFW5DKA3tI33Fxy+fLgAXM7/s/AXmCQBAFx/87g2Qqy/ZyxZfcTigyWEjRQG&lt;br /&gt;
 xtpQsWMZ5/67OmslnQojs4iYLVDN2RXx85Q2O/6rq2OgKZPjx/aCmcR6U5nwjIsq&lt;br /&gt;
 ZF+r8eNAkbyPNIqpWVE8jYpk3hn8iue6huK+KzqrHJckJyp+UiTSSj/3bDp/+lcO&lt;br /&gt;
 JfuSCG80W+05SCw5/TqLBVaFZCsxYZVU/ik9WwW7a5yTgE8cvXcoLbJ0dMqSGx0c&lt;br /&gt;
 wcdJydHZuOKP8t5EJICbyKfeKnZmFFCLhn15uqIOkJjUQ4dYeYoYQb08NKh67+Uk&lt;br /&gt;
 V4F2MGf47aQ4skORCvA3vaO5rUGdsyvvfJ+F7DQ1KYinvBTRfJ/hSjli+E20leOH&lt;br /&gt;
 yjwcYaRXpN2pKM34eGZFaKiYssSWcaTQngkyGgZDbesT93G/bnrma+1yG57CjX/9&lt;br /&gt;
 Qz5Iy+6e/6tqGTOvvIaQUTs+QdfUAys//usHefyliY6BkxESLZiejB6vKm22UfQG&lt;br /&gt;
 4pjAF2BUyDHxqHCdOxgUroDcxspM&lt;br /&gt;
 =OOBX&lt;br /&gt;
 -----END PGP PUBLIC KEY BLOCK-----&lt;br /&gt;
&lt;br /&gt;
[[Category: OX6]]&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_Debian_12.0&amp;diff=28807</id>
		<title>AppSuite:Open-Xchange Installation Guide for Debian 12.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_Debian_12.0&amp;diff=28807"/>
		<updated>2024-09-06T15:19:26Z</updated>

		<summary type="html">&lt;p&gt;Marens: Distro and JDK specific updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.6}}&lt;br /&gt;
&lt;br /&gt;
= OX App Suite on Debian GNU/Linux 12 =&lt;br /&gt;
&lt;br /&gt;
This article will guide you through the installation of OX App Suite, it describes the basic configuration and software requirements. As it is intended as a quick walk-through it assumes an existing installation of the operating system and requires average system administration skills. More, this guide will show you how to setup a basic installation with none of the typically used distributed environment settings. The objective of this guide is:&lt;br /&gt;
&lt;br /&gt;
* To setup a single server installation&lt;br /&gt;
* To setup a database for a single database service, no replication&lt;br /&gt;
* To setup a single Open-Xchange instance, no cluster&lt;br /&gt;
* To provide a basic configuration setup, no mailserver configuration&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
* Plain installed Debian GNU/Linux 12, no graphical tools required&lt;br /&gt;
* A supported Java Virtual Machine ([https://oxpedia.org/wiki/index.php?title=AppSuite:OX_System_Requirements#Server_Platforms learn more])&lt;br /&gt;
* A working internet connection&lt;br /&gt;
* vim is not installed by default on Debian. If you want to copy &amp;amp; paste the commands from this article into a shell window, you need to apt-get install vim first.&lt;br /&gt;
&lt;br /&gt;
= Database installation =&lt;br /&gt;
&lt;br /&gt;
Please consult our [[OXLoadBalancingClustering_Database#Standalone_database_setup|database installation instructions]] for information on how to install a database on the local system.&lt;br /&gt;
&lt;br /&gt;
Before proceeding, make sure the local machine has got a working MySQL service in one of the supported versions / flavors with the configuration / tunings applied as mentioned on our [[My.cnf|corresponding page]].&lt;br /&gt;
&lt;br /&gt;
= JRE Installation =&lt;br /&gt;
&lt;br /&gt;
Debian Bookworm ships with OpenJDK 17, which is not suitable for OX App Suite. It is therefore required to install Eclipse Temurin 8 JRE with HotSpot VM. A comprehensive installation guide can be found at https://adoptium.net/de/installation/linux/#_deb_installation_on_debian_or_ubuntu. Quick instructions are:&lt;br /&gt;
&lt;br /&gt;
 # install repo key&lt;br /&gt;
 $ apt install -y wget apt-transport-https gpg&lt;br /&gt;
 $ wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
 # add repository&lt;br /&gt;
 $ echo &amp;quot;deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main&amp;quot; | tee /etc/apt/sources.list.d/adoptium.list&lt;br /&gt;
&lt;br /&gt;
 # install jdk&lt;br /&gt;
 $ apt update # update if you haven't already&lt;br /&gt;
 $ apt install temurin-8-jdk&lt;br /&gt;
&lt;br /&gt;
= Add Open-Xchange Repository =&lt;br /&gt;
&lt;br /&gt;
Open-Xchange maintains public available software repositories for different platforms, such as Debian. This repository should be added to the Debian installation to enable simple installation and updates.&lt;br /&gt;
&lt;br /&gt;
Start a console and modify the Debian repository information file. Also add the Open-Xchange software repository:&lt;br /&gt;
&lt;br /&gt;
 $ cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/apt/sources.list.d/open-xchange.list&lt;br /&gt;
 &lt;br /&gt;
 deb https://software.open-xchange.com/products/appsuite/stable/appsuiteui/DebianBookworm/ /&lt;br /&gt;
 deb https://software.open-xchange.com/products/appsuite/stable/backend/DebianBookworm/ / &lt;br /&gt;
 &lt;br /&gt;
 # if you have a valid maintenance subscription, please uncomment the &lt;br /&gt;
 # following and add the ldb account data to the url so that the most recent&lt;br /&gt;
 # packages get installed&lt;br /&gt;
 # deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/DebianBookworm /&lt;br /&gt;
 # deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/appsuite/stable/backend/updates/DebianBookworm /&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
= Updating repositories and install packages =&lt;br /&gt;
&lt;br /&gt;
It is highly recommended to import the Open-Xchange build key to your package systems trusted keyring in order to make sure only Open-Xchange packages with valid signing are installed on the system. Otherwise you'll encounter warnings about untrusted package sources. To import the Open-Xchange buildkey, please refer to this quick guide: [[Importing_OX_Buildkey#Importing_key_into_apt_based_systems|Importing OX Buildkey]].&lt;br /&gt;
&lt;br /&gt;
Reload the package index. This will download the package descriptions available at the software repositories and will enable the Open-Xchange repository as a valid source for signed packages:&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
&lt;br /&gt;
The following command starts the download and installation process of all required package for Open-Xchange deployment:&lt;br /&gt;
&lt;br /&gt;
If you want to install everything on a single server, just run&lt;br /&gt;
&lt;br /&gt;
 $ apt-get install open-xchange open-xchange-authentication-database open-xchange-grizzly \&lt;br /&gt;
   open-xchange-admin open-xchange-appsuite \&lt;br /&gt;
   open-xchange-appsuite-backend open-xchange-appsuite-manifest&lt;br /&gt;
&lt;br /&gt;
'''Note 1:''' You have to choose between one of the available authentication packages depending on your requirements.&lt;br /&gt;
Open-Xchange configuration&lt;br /&gt;
&lt;br /&gt;
To avoid confusion right at the start notice that Open-Xchange uses multiple administration levels and requires different credentials at some stages at the installation and server management. Note that the passwords chosen at this guide are weak and should be replaced by stronger passwords.&lt;br /&gt;
&lt;br /&gt;
The MySQL database user&lt;br /&gt;
* Username: openexchange&lt;br /&gt;
* Password used at this guide: db_password&lt;br /&gt;
* Responsibility: Execute all kinds of database operations&lt;br /&gt;
&lt;br /&gt;
The Open-Xchange Admin Master&lt;br /&gt;
* Username: oxadminmaster&lt;br /&gt;
* Password used at this guide: admin_master_password&lt;br /&gt;
* Responsibility: Manage contexts, manage all kinds of low level server configuration&lt;br /&gt;
&lt;br /&gt;
The Context Admin&lt;br /&gt;
* Username: oxadmin&lt;br /&gt;
* Password used at this guide: admin_password&lt;br /&gt;
* Responsibility: Manage users/groups/resources inside a context&lt;br /&gt;
&lt;br /&gt;
As stated above we assume the MySQL service has been installed previously, and it is running and available.&lt;br /&gt;
&lt;br /&gt;
A good idea is to add the Open-Xchange binaries to PATH:&lt;br /&gt;
&lt;br /&gt;
 $  echo PATH=$PATH:/opt/open-xchange/sbin/ &amp;gt;&amp;gt; ~/.bashrc &amp;amp;&amp;amp; . ~/.bashrc&lt;br /&gt;
&lt;br /&gt;
Now we have to initialize the Open-Xchange configdb database. This can all be done by executing the initconfigdb script.&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/initconfigdb --configdb-pass=db_password -a --mysql-root-passwd=root_password&lt;br /&gt;
&lt;br /&gt;
Use the --mysql-root-passwd option to supply the MySQL root password as configured during database installation.&lt;br /&gt;
&lt;br /&gt;
Add the -i option if you want to remove an already existing open-xchange configdb.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' The -a parameter adds an openexchange account to MySQL. This account will be used for database connections from the OX App Suite middleware and requires [https://documentation.open-xchange.com/7.10.6/middleware/administration/db_user_privileges.html some privileges]. You can also create that account manually [https://oxpedia.org/wiki/index.php?title=OXLoadBalancingClustering_Database#Creating_Open-Xchange_user during database installation / configuration], in which case you can (should) skip the -a parameter here.&lt;br /&gt;
&lt;br /&gt;
Before starting any service, all basic configuration files need to be set up correctly. The --configdb-pass option indicates the password of the openexchange database user previously created, the --master-pass options specifies the password of the Open-Xchange adminmaster user that will be created when executing the oxinstaller script.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' You should have your Open-Xchange license code at hand. If you do not plan to license Open-Xchange, you can use the option --no-license instead. Please also check [https://documentation.open-xchange.com/7.10.6/middleware/miscellaneous/report_client.html OXReportClient] documentation for more information about configuring a supported and maintained Open-Xchange server.&lt;br /&gt;
&lt;br /&gt;
'''Important:''' For MAX_MEMORY_FOR_JAVAVM a rule of thumb for simple installations is half available system memory. The value must be in MB. For example &amp;quot;1024&amp;quot; for 1GB .&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/oxinstaller --add-license=YOUR-OX-LICENSE-CODE \&lt;br /&gt;
 --servername=oxserver --configdb-pass=db_password \&lt;br /&gt;
 --master-pass=admin_master_password --network-listener-host=localhost --servermemory MAX_MEMORY_FOR_JAVAVM&lt;br /&gt;
&lt;br /&gt;
'''Note:''' In a clustered setup, --network-listener-host must be set to *&lt;br /&gt;
&lt;br /&gt;
Now is a good time to configure the way OX will authenticate to your mail server. Edit the file /opt/open-xchange/etc/mail.properties and change the com.openexchange.mail.loginSource to use. This is very important for servers that require your full email address to log in with.&lt;br /&gt;
&lt;br /&gt;
 # adjust com.openexchange.mail.loginSource&lt;br /&gt;
 $ vim /opt/open-xchange/etc/mail.properties&lt;br /&gt;
&lt;br /&gt;
After initializing the configuration, restart the Open-Xchange Administration service by executing:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl restart open-xchange&lt;br /&gt;
&lt;br /&gt;
Next we have to register the local server at the Open-Xchange configdb database:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerserver -n oxserver -A oxadminmaster -P admin_master_password&lt;br /&gt;
&lt;br /&gt;
Now we have to create a local directory that should be used as Open-Xchange filestore. This directory will contain all Infostore content and files attached to groupware objects. To maintain access by the Open-Xchange Groupware service, it is required to grant permissions to the open-xchange system user.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir /var/opt/filestore&lt;br /&gt;
 $ chown open-xchange:open-xchange /var/opt/filestore&lt;br /&gt;
&lt;br /&gt;
Now register the directory as a filestore at the Open-Xchange server:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerfilestore -A oxadminmaster -P admin_master_password \&lt;br /&gt;
 -t file:/var/opt/filestore -s 1000000&lt;br /&gt;
&lt;br /&gt;
'''Note:''' You might want to adapt the value provided with -s, the &amp;quot;The maximum size of the filestore in MB&amp;quot;, see registerfilestore --help.&lt;br /&gt;
&lt;br /&gt;
'''Note 2:''' If you are setting up OX App Suite, you need a shared filestore accross your OX servers even though you do not plan to have the OX Files feature enabled for your customers.&lt;br /&gt;
&lt;br /&gt;
Finally register the groupware database, this is a separated database where all groupware specific data is stored:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/registerdatabase -A oxadminmaster -P admin_master_password \&lt;br /&gt;
 -n oxdatabase -p db_password -m true&lt;br /&gt;
&lt;br /&gt;
'''Note 3:''' Take into account that a global database is needed in order to store data across context boundaries. Please see this [https://oxpedia.org/wiki/index.php?title=AppSuite:CrossContextDatabase documentation] on how to register it.&lt;br /&gt;
&lt;br /&gt;
= Configure services =&lt;br /&gt;
&lt;br /&gt;
Now as the Open-Xchange Server has been set up and the database is running, we have to configure the Apache webserver and the mod_proxy_http module to access the groupware frontend. &amp;lt;!-- To gain better GUI performance, the usage of mod_expires and mod_deflate is strongly recommended. Those modules will limit the amount of client requests and compress the delivered content. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ a2enmod proxy proxy_http proxy_balancer expires deflate headers rewrite mime setenvif lbmethod_byrequests&lt;br /&gt;
&lt;br /&gt;
Configure the mod_proxy_http module by creating a new Apache configuration file.&lt;br /&gt;
&lt;br /&gt;
 $ vim /etc/apache2/conf-available/proxy_http.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfModule mod_proxy_http.c&amp;gt;&lt;br /&gt;
    ProxyRequests Off&lt;br /&gt;
    ProxyStatus On&lt;br /&gt;
    # When enabled, this option will pass the Host: line from the incoming request to the proxied host.&lt;br /&gt;
    ProxyPreserveHost On&lt;br /&gt;
    # Please note that the servlet path to the soap API has changed:&lt;br /&gt;
    &amp;lt;Location /webservices&amp;gt;&lt;br /&gt;
        # restrict access to the soap provisioning API&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
        # you might add more ip addresses / networks here&lt;br /&gt;
        # Allow from 192.168 10 172.16&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # The old path is kept for compatibility reasons&lt;br /&gt;
    &amp;lt;Location /servlet/axis2/services&amp;gt;&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # Enable the balancer manager mentioned in&lt;br /&gt;
    # https://oxpedia.org/wiki/index.php?title=AppSuite:Running_a_cluster#Updating_a_Cluster&lt;br /&gt;
    &amp;lt;IfModule mod_status.c&amp;gt;&lt;br /&gt;
      &amp;lt;Location /balancer-manager&amp;gt;&lt;br /&gt;
        SetHandler balancer-manager&lt;br /&gt;
        Order Deny,Allow&lt;br /&gt;
        Deny from all&lt;br /&gt;
        Allow from 127.0.0.1&lt;br /&gt;
      &amp;lt;/Location&amp;gt; &lt;br /&gt;
    &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;Proxy balancer://oxcluster&amp;gt;&lt;br /&gt;
        Order deny,allow&lt;br /&gt;
        Allow from all&lt;br /&gt;
        # multiple server setups need to have the hostname inserted instead localhost&lt;br /&gt;
        BalancerMember http://localhost:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1&lt;br /&gt;
        # Enable and maybe add additional hosts running OX here&lt;br /&gt;
        # BalancerMember http://oxhost2:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP2&lt;br /&gt;
       ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
       SetEnv proxy-initial-not-pooled&lt;br /&gt;
       SetEnv proxy-sendchunked&lt;br /&gt;
    &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    # The standalone documentconverter(s) within your setup (if installed)&lt;br /&gt;
    # Make sure to restrict access to backends only&lt;br /&gt;
    # See: https://httpd.apache.org/docs/$YOUR_VERSION/mod/mod_authz_host.html#allow for more infos&lt;br /&gt;
    #&amp;lt;Proxy balancer://oxcluster_docs&amp;gt;&lt;br /&gt;
    #    Order Deny,Allow&lt;br /&gt;
    #    Deny from all&lt;br /&gt;
    #    Allow from backend1IP&lt;br /&gt;
    #    BalancerMember http://converter_host:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 keepalive=On  route=APP3&lt;br /&gt;
    #    ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
    #       SetEnv proxy-initial-not-pooled&lt;br /&gt;
    #    SetEnv proxy-sendchunked&lt;br /&gt;
    #&amp;lt;/Proxy&amp;gt;&lt;br /&gt;
    # Define another Proxy Container with different timeout for the sync clients. Microsoft recommends a minimum value of 15 minutes.&lt;br /&gt;
    # Setting the value lower than the one defined as com.openexchange.usm.eas.ping.max_heartbeat in eas.properties will lead to connection&lt;br /&gt;
    # timeouts for clients.  See https://support.microsoft.com/?kbid=905013 for additional information.&lt;br /&gt;
    #&lt;br /&gt;
    # NOTE for Apache versions &amp;lt; 2.4:&lt;br /&gt;
    # When using a single node system or using BalancerMembers that are assigned to other balancers please add a second hostname for that&lt;br /&gt;
    # BalancerMember's IP so Apache can treat it as additional BalancerMember with a different timeout.&lt;br /&gt;
    #&lt;br /&gt;
    # Example from /etc/hosts: 127.0.0.1    localhost localhost_sync&lt;br /&gt;
    #&lt;br /&gt;
   # Alternatively select one or more hosts of your cluster to be restricted to handle only eas/usm requests&lt;br /&gt;
   &amp;lt;Proxy balancer://eas_oxcluster&amp;gt;&lt;br /&gt;
      Order deny,allow&lt;br /&gt;
      Allow from all&lt;br /&gt;
      # multiple server setups need to have the hostname inserted instead localhost&lt;br /&gt;
      BalancerMember http://localhost_sync:8009 timeout=1900 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1&lt;br /&gt;
      # Enable and maybe add additional hosts running OX here&lt;br /&gt;
      # BalancerMember http://oxhost2:8009 timeout=1900  smax=0 ttl=60 retry=60 loadfactor=50 route=APP2&lt;br /&gt;
      ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On&lt;br /&gt;
      SetEnv proxy-initial-not-pooled&lt;br /&gt;
      SetEnv proxy-sendchunked&lt;br /&gt;
    &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
   # When specifying additional mappings via the ProxyPass directive be aware that the first matching rule wins. Overlapping urls of&lt;br /&gt;
   # mappings have to be ordered from longest URL to shortest URL.&lt;br /&gt;
   # &lt;br /&gt;
   # Example:&lt;br /&gt;
   #   ProxyPass /ajax      balancer://oxcluster_with_100s_timeout/ajax&lt;br /&gt;
   #   ProxyPass /ajax/test balancer://oxcluster_with_200s_timeout/ajax/test&lt;br /&gt;
   #&lt;br /&gt;
   # Requests to /ajax/test would have a timeout of 100s instead of 200s &lt;br /&gt;
   #   &lt;br /&gt;
   # See:&lt;br /&gt;
   # - https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass Ordering ProxyPass Directives&lt;br /&gt;
   # - https://httpd.apache.org/docs/current/mod/mod_proxy.html#workers Worker Sharing&lt;br /&gt;
   ProxyPass /ajax balancer://oxcluster/ajax&lt;br /&gt;
   ProxyPass /appsuite/api balancer://oxcluster/ajax&lt;br /&gt;
   ProxyPass /drive balancer://oxcluster/drive&lt;br /&gt;
   ProxyPass /infostore balancer://oxcluster/infostore&lt;br /&gt;
   ProxyPass /realtime balancer://oxcluster/realtime&lt;br /&gt;
   ProxyPass /servlet balancer://oxcluster/servlet&lt;br /&gt;
   ProxyPass /webservices balancer://oxcluster/webservices&lt;br /&gt;
 &lt;br /&gt;
   #ProxyPass /documentconverterws balancer://oxcluster_docs/documentconverterws&lt;br /&gt;
 &lt;br /&gt;
   ProxyPass /usm-json balancer://eas_oxcluster/usm-json&lt;br /&gt;
   ProxyPass /Microsoft-Server-ActiveSync balancer://eas_oxcluster/Microsoft-Server-ActiveSync&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modify the default website settings to display the Open-Xchange GUI&lt;br /&gt;
&lt;br /&gt;
 $ vim /etc/apache2/sites-enabled/000-default.conf&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin webmaster@localhost&lt;br /&gt;
 &lt;br /&gt;
        DocumentRoot /var/www/html&lt;br /&gt;
        &amp;lt;Directory /var/www/html&amp;gt;&lt;br /&gt;
                Options -Indexes +FollowSymLinks +MultiViews&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
                RedirectMatch ^/$ /appsuite/&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
        &amp;lt;Directory /var/www/html/appsuite&amp;gt;&lt;br /&gt;
                Options None +SymLinksIfOwnerMatch&lt;br /&gt;
                AllowOverride Indexes FileInfo&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
 &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to secure your Apache setup via HTTPS (which is highly recommended) or if you have proxies in front of your Apache please follow the instructions at:&lt;br /&gt;
&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#.2Fopt.2Fopen-xchange.2Fetc.2Fserver.conf Grizzly configuration] in general, and specifically:&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#X-FORWARDED-PROTO_Header X-FORWARDED-PROTO Header]&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#X-FORWARDED-FOR_Header X-FORWARDED-FOR Header]&lt;br /&gt;
&lt;br /&gt;
to properly instruct the backend about the security status of the connection and the remote IP used to contact the backend.&lt;br /&gt;
&lt;br /&gt;
Enable the proxy configuration&lt;br /&gt;
&lt;br /&gt;
 $ a2enconf proxy_http.conf&lt;br /&gt;
&lt;br /&gt;
After the configuration is done, restart the Apache webserver&lt;br /&gt;
&lt;br /&gt;
 $ systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
== Apache Setting for more concurrent Connections ==&lt;br /&gt;
&lt;br /&gt;
By default apache2 is configured to support 150 concurrent connections. This forces all parallel requests beyond that limit to wait. Especially if, for example, active sync clients maintain a permanent connection for push events to arrive. The following article explains how that can be done&lt;br /&gt;
&lt;br /&gt;
[https://oxpedia.org/wiki/index.php?title=Tune_apache2_for_more_concurrent_connections Apache Setting for more concurrent Connections]&lt;br /&gt;
&lt;br /&gt;
= Creating contexts and users =&lt;br /&gt;
&lt;br /&gt;
Now as the whole setup is complete and you already should get a login screen when accessing the server with a webbrowser, we have to setup a context and a default user as the last step of this tutorial.&lt;br /&gt;
&lt;br /&gt;
The mapping defaultcontext will allow you to set this context as the default one of the entire system so that users which will be created within this context can login into Open-Xchange Server without specifying their domain at the login screen. Only one context can be specified as defaultcontext. The oxadmin user that will be created by this command is the default admin of the created context. This account will gather additional functions that are also described in the administration manual. The context id parameter must to be unique and numeric, otherwise the server will complain when you try to create a context. New contexts must be created by the oxadminmaster user, user accounts inside a context are created with the credentials of the contexts oxadmin account. The access-combination-name property defines the set of available modules and functions for users of the context.&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/createcontext -A oxadminmaster -P admin_master_password -c 1 \&lt;br /&gt;
 -u oxadmin -d &amp;quot;Context Admin&amp;quot; -g Admin -s User -p admin_password -L defaultcontext \&lt;br /&gt;
 -e oxadmin@example.com -q 1024 --access-combination-name=groupware_standard&lt;br /&gt;
&lt;br /&gt;
To create a user for testing purposes (Make sure the password you use here for the user is the same password as your email account or you will not be able to use the email module until it is set right):&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/createuser -c 1 -A oxadmin -P admin_password -u testuser \&lt;br /&gt;
 -d &amp;quot;Test User&amp;quot; -g Test -s User -p secret -e testuser@example.com \&lt;br /&gt;
 --imaplogin testuser --imapserver 127.0.0.1 --smtpserver 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
Now connect to the server with a webbrowser and login using the credentials testuser / secret.&lt;br /&gt;
&lt;br /&gt;
A complete overview about the different parameter is provided at the [https://oxpedia.org/wiki/index.php?title=OX_Permission_Level permission matrix].&lt;br /&gt;
&lt;br /&gt;
If you need to migrate a batch of users and contexts at once, check the CSV Batch Import documentation [https://oxpedia.org/wiki/index.php?title=Csv_import page].&lt;br /&gt;
&lt;br /&gt;
= Log files and issue tracking =&lt;br /&gt;
&lt;br /&gt;
== Default logging mechanism ==&lt;br /&gt;
&lt;br /&gt;
Whenever unexpected or erroneous behavior takes place, it will be logged depending on the configured loglevel. All logfiles are stored at the operating systems default location. Events triggered by the Open-Xchange Groupware services are logged to a rotating file open-xchange.log.0. Those files are the very first place to monitor.&lt;br /&gt;
&lt;br /&gt;
 $ tail -f -n200 /var/log/open-xchange/open-xchange.log.0&lt;br /&gt;
&lt;br /&gt;
== Alternative logging mechanisms ==&lt;br /&gt;
&lt;br /&gt;
Apart from the default file logging mechanism, Open-Xchange supports logging via logback framework and therefore via syslog and/or logstash. This makes it possible to directly log to a local or remote syslog daemon or other services. Logback is highly customizable, please see the documentation below.&lt;br /&gt;
&lt;br /&gt;
* [https://oxpedia.org/wiki/index.php?title=AppSuite:OX_Logging Logback configuration Guide OX App Suite]&lt;br /&gt;
&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28418</id>
		<title>AppSuite:Open-Xchange Installation Guide for RHEL8</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28418"/>
		<updated>2023-10-09T16:05:04Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Apache and SELinux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.6}}&lt;br /&gt;
&lt;br /&gt;
= Open-Xchange App Suite on RedHat Enterprise Linux 8 =&lt;br /&gt;
&lt;br /&gt;
{{QuickInstIntro|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
* Plain installed RedHat Enterprise Linux 8 with latest updates&lt;br /&gt;
* Valid access to the RedHat Network&lt;br /&gt;
* A configured internet connection&lt;br /&gt;
* A supported Java Virtual Machine ([http://oxpedia.org/wiki/index.php?title=AppSuite:OX_System_Requirements#Server_Platforms learn more])&lt;br /&gt;
* &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; is not installed by default on RHEL8. If you want to copy &amp;amp; paste the commands from this article into a shell window, you need to &amp;lt;code&amp;gt;dnf install vim&amp;lt;/code&amp;gt; first.&lt;br /&gt;
&lt;br /&gt;
= Database installation =&lt;br /&gt;
&lt;br /&gt;
Please consult our [[OXLoadBalancingClustering_Database#Standalone_database_setup|database installation instructions]] for information on how to install a database on the local system.&lt;br /&gt;
&lt;br /&gt;
Before proceeding, make sure the local machine has got a working MySQL service in one of the supported versions / flavors with the configuration / tunings applied as mentioned on our [[My.cnf|corresponding page]].&lt;br /&gt;
&lt;br /&gt;
= Enabling required RedHat Repositories =&lt;br /&gt;
&lt;br /&gt;
Ensure that your Redhat system is subscribed by e.g. following this article https://access.redhat.com/solutions/253273&lt;br /&gt;
&lt;br /&gt;
{{AddReposRHEL|rhelname=RHEL8|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Updating repositories and installing packages =&lt;br /&gt;
&lt;br /&gt;
Reload the package index. This will download the package descriptions available at the software repositories:&lt;br /&gt;
&lt;br /&gt;
 $ dnf update&lt;br /&gt;
&lt;br /&gt;
The following command starts the download and installation process of all required package for Open-Xchange deployment:&lt;br /&gt;
&lt;br /&gt;
{{OXPackageInstallation|installer=dnf|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
{{OXConfiguration}}&lt;br /&gt;
&lt;br /&gt;
{{oxinstaller|connector=http}}&lt;br /&gt;
&lt;br /&gt;
After initializing the configuration, start the Open-Xchange service by executing:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start open-xchange&lt;br /&gt;
&lt;br /&gt;
{{OXRegister|globaldb=true}}&lt;br /&gt;
&lt;br /&gt;
= Configure services =&lt;br /&gt;
&lt;br /&gt;
{{ApacheOXModsIntro|connector=http}}&lt;br /&gt;
&lt;br /&gt;
The default installation of the Apache webserver on RHEL provides a welcome screen which is not necessary for server operation, it can be removed by deleting the corresponding configuration file:&lt;br /&gt;
&lt;br /&gt;
 $ rm /etc/httpd/conf.d/welcome.conf&lt;br /&gt;
&lt;br /&gt;
{{Template:ApacheAppSuiteConf|connector=http|connectorConf=/etc/httpd/conf.d/proxy_http.conf|apacheconf=/etc/httpd/conf.d/ox.conf|docroot=/var/www/html/|loadmodule=LoadModule proxy_http_module modules/mod_proxy_http.so|syncProxyName=eas_oxcluster}}&lt;br /&gt;
&lt;br /&gt;
== Apache and SELinux ==&lt;br /&gt;
&lt;br /&gt;
When using SELinux make sure to allow Apache to connect to the middleware process on port 8009. One way to achieve this could be:&lt;br /&gt;
&lt;br /&gt;
 $ setsebool -P httpd_can_network_connect 1&lt;br /&gt;
&lt;br /&gt;
The following links contain more infos:&lt;br /&gt;
* [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-the_apache_http_server SELinux: The Apache HTTP Server]&lt;br /&gt;
* [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-managing_confined_services-the_apache_http_server-booleans SELinux: The Apache HTTP Server - Booleans]&lt;br /&gt;
&lt;br /&gt;
After the configuration is done, restart the Apache webserver&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start httpd&lt;br /&gt;
&lt;br /&gt;
== Apache Setting for more concurrent Connections ==&lt;br /&gt;
&lt;br /&gt;
By default apache2 is configured to support 150 concurrent connections. This forces all parallel requests beyond that limit to wait. Especially if, for example, active sync clients maintain a permanent connection for push events to arrive. The following article explains how that can be done&lt;br /&gt;
&lt;br /&gt;
[[Tune_apache2_for_more_concurrent_connections|Apache Setting for more concurrent Connections]]&lt;br /&gt;
&lt;br /&gt;
= Adding services to runlevels =&lt;br /&gt;
&lt;br /&gt;
The new services are now installed and configured, but to make them start up on a server boot, they need to be added to some runlevels:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl enable mariadb&lt;br /&gt;
 $ systemctl enable httpd&lt;br /&gt;
 $ systemctl enable open-xchange&lt;br /&gt;
&lt;br /&gt;
{{ContextUserAndLogs}}&lt;br /&gt;
&lt;br /&gt;
= Installing Open-Xchange Update packages =&lt;br /&gt;
&lt;br /&gt;
Please read [[UpdatingOXPackages]] on how to get access to the latest Open-Xchange packages.&lt;br /&gt;
&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28415</id>
		<title>AppSuite:Open-Xchange Installation Guide for RHEL8</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28415"/>
		<updated>2023-10-09T16:04:19Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.6}}&lt;br /&gt;
&lt;br /&gt;
= Open-Xchange App Suite on RedHat Enterprise Linux 8 =&lt;br /&gt;
&lt;br /&gt;
{{QuickInstIntro|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
* Plain installed RedHat Enterprise Linux 8 with latest updates&lt;br /&gt;
* Valid access to the RedHat Network&lt;br /&gt;
* A configured internet connection&lt;br /&gt;
* A supported Java Virtual Machine ([http://oxpedia.org/wiki/index.php?title=AppSuite:OX_System_Requirements#Server_Platforms learn more])&lt;br /&gt;
* &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; is not installed by default on RHEL8. If you want to copy &amp;amp; paste the commands from this article into a shell window, you need to &amp;lt;code&amp;gt;dnf install vim&amp;lt;/code&amp;gt; first.&lt;br /&gt;
&lt;br /&gt;
= Database installation =&lt;br /&gt;
&lt;br /&gt;
Please consult our [[OXLoadBalancingClustering_Database#Standalone_database_setup|database installation instructions]] for information on how to install a database on the local system.&lt;br /&gt;
&lt;br /&gt;
Before proceeding, make sure the local machine has got a working MySQL service in one of the supported versions / flavors with the configuration / tunings applied as mentioned on our [[My.cnf|corresponding page]].&lt;br /&gt;
&lt;br /&gt;
= Enabling required RedHat Repositories =&lt;br /&gt;
&lt;br /&gt;
Ensure that your Redhat system is subscribed by e.g. following this article https://access.redhat.com/solutions/253273&lt;br /&gt;
&lt;br /&gt;
{{AddReposRHEL|rhelname=RHEL8|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Updating repositories and installing packages =&lt;br /&gt;
&lt;br /&gt;
Reload the package index. This will download the package descriptions available at the software repositories:&lt;br /&gt;
&lt;br /&gt;
 $ dnf update&lt;br /&gt;
&lt;br /&gt;
The following command starts the download and installation process of all required package for Open-Xchange deployment:&lt;br /&gt;
&lt;br /&gt;
{{OXPackageInstallation|installer=dnf|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
{{OXConfiguration}}&lt;br /&gt;
&lt;br /&gt;
{{oxinstaller|connector=http}}&lt;br /&gt;
&lt;br /&gt;
After initializing the configuration, start the Open-Xchange service by executing:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start open-xchange&lt;br /&gt;
&lt;br /&gt;
{{OXRegister|globaldb=true}}&lt;br /&gt;
&lt;br /&gt;
= Configure services =&lt;br /&gt;
&lt;br /&gt;
{{ApacheOXModsIntro|connector=http}}&lt;br /&gt;
&lt;br /&gt;
The default installation of the Apache webserver on RHEL provides a welcome screen which is not necessary for server operation, it can be removed by deleting the corresponding configuration file:&lt;br /&gt;
&lt;br /&gt;
 $ rm /etc/httpd/conf.d/welcome.conf&lt;br /&gt;
&lt;br /&gt;
{{Template:ApacheAppSuiteConf|connector=http|connectorConf=/etc/httpd/conf.d/proxy_http.conf|apacheconf=/etc/httpd/conf.d/ox.conf|docroot=/var/www/html/|loadmodule=LoadModule proxy_http_module modules/mod_proxy_http.so|syncProxyName=eas_oxcluster}}&lt;br /&gt;
&lt;br /&gt;
== Apache and SELinux ==&lt;br /&gt;
&lt;br /&gt;
When using selinux make sure to allow Apache to connect to the middleware process on port 8009. One way to achieve this could be:&lt;br /&gt;
&lt;br /&gt;
 $ setsebool -P httpd_can_network_connect 1&lt;br /&gt;
&lt;br /&gt;
The following links contain more infos:&lt;br /&gt;
* [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-the_apache_http_server SELinux: The Apache HTTP Server]&lt;br /&gt;
* [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-managing_confined_services-the_apache_http_server-booleans SELinux: The Apache HTTP Server - Booleans]&lt;br /&gt;
&lt;br /&gt;
After the configuration is done, restart the Apache webserver&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start httpd&lt;br /&gt;
&lt;br /&gt;
== Apache Setting for more concurrent Connections ==&lt;br /&gt;
&lt;br /&gt;
By default apache2 is configured to support 150 concurrent connections. This forces all parallel requests beyond that limit to wait. Especially if, for example, active sync clients maintain a permanent connection for push events to arrive. The following article explains how that can be done&lt;br /&gt;
&lt;br /&gt;
[[Tune_apache2_for_more_concurrent_connections|Apache Setting for more concurrent Connections]]&lt;br /&gt;
&lt;br /&gt;
= Adding services to runlevels =&lt;br /&gt;
&lt;br /&gt;
The new services are now installed and configured, but to make them start up on a server boot, they need to be added to some runlevels:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl enable mariadb&lt;br /&gt;
 $ systemctl enable httpd&lt;br /&gt;
 $ systemctl enable open-xchange&lt;br /&gt;
&lt;br /&gt;
{{ContextUserAndLogs}}&lt;br /&gt;
&lt;br /&gt;
= Installing Open-Xchange Update packages =&lt;br /&gt;
&lt;br /&gt;
Please read [[UpdatingOXPackages]] on how to get access to the latest Open-Xchange packages.&lt;br /&gt;
&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28385</id>
		<title>AppSuite:Open-Xchange Installation Guide for RHEL8</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_RHEL8&amp;diff=28385"/>
		<updated>2023-10-09T11:57:23Z</updated>

		<summary type="html">&lt;p&gt;Marens: dnf is default since rhel8&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.6}}&lt;br /&gt;
&lt;br /&gt;
= Open-Xchange App Suite on RedHat Enterprise Linux 8 =&lt;br /&gt;
&lt;br /&gt;
{{QuickInstIntro|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
* Plain installed RedHat Enterprise Linux 8 with latest updates&lt;br /&gt;
* Valid access to the RedHat Network&lt;br /&gt;
* A configured internet connection&lt;br /&gt;
* A supported Java Virtual Machine ([http://oxpedia.org/wiki/index.php?title=AppSuite:OX_System_Requirements#Server_Platforms learn more])&lt;br /&gt;
* &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; is not installed by default on RHEL8. If you want to copy &amp;amp; paste the commands from this article into a shell window, you need to &amp;lt;code&amp;gt;dnf install vim&amp;lt;/code&amp;gt; first.&lt;br /&gt;
&lt;br /&gt;
= Database installation =&lt;br /&gt;
&lt;br /&gt;
Please consult our [[OXLoadBalancingClustering_Database#Standalone_database_setup|database installation instructions]] for information on how to install a database on the local system.&lt;br /&gt;
&lt;br /&gt;
Before proceeding, make sure the local machine has got a working MySQL service in one of the supported versions / flavors with the configuration / tunings applied as mentioned on our [[My.cnf|corresponding page]].&lt;br /&gt;
&lt;br /&gt;
= Enabling required RedHat Repositories =&lt;br /&gt;
&lt;br /&gt;
Ensure that your Redhat system is subscribed by e.g. following this article https://access.redhat.com/solutions/253273&lt;br /&gt;
&lt;br /&gt;
{{AddReposRHEL|rhelname=RHEL8|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
= Updating repositories and installing packages =&lt;br /&gt;
&lt;br /&gt;
Reload the package index. This will download the package descriptions available at the software repositories:&lt;br /&gt;
&lt;br /&gt;
 $ dnf update&lt;br /&gt;
&lt;br /&gt;
The following command starts the download and installation process of all required package for Open-Xchange deployment:&lt;br /&gt;
&lt;br /&gt;
{{OXPackageInstallation|installer=dnf|release=appsuite}}&lt;br /&gt;
&lt;br /&gt;
{{OXConfiguration}}&lt;br /&gt;
&lt;br /&gt;
{{oxinstaller|connector=http}}&lt;br /&gt;
&lt;br /&gt;
After initializing the configuration, start the Open-Xchange service by executing:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start open-xchange&lt;br /&gt;
&lt;br /&gt;
{{OXRegister|globaldb=true}}&lt;br /&gt;
&lt;br /&gt;
= Configure services =&lt;br /&gt;
&lt;br /&gt;
{{ApacheOXModsIntro|connector=http}}&lt;br /&gt;
&lt;br /&gt;
The default installation of the Apache webserver on RHEL provides a welcome screen which is not necessary for server operation, it can be removed by deleting the corresponding configuration file:&lt;br /&gt;
&lt;br /&gt;
 $ rm /etc/httpd/conf.d/welcome.conf&lt;br /&gt;
&lt;br /&gt;
{{Template:ApacheAppSuiteConf|connector=http|connectorConf=/etc/httpd/conf.d/proxy_http.conf|apacheconf=/etc/httpd/conf.d/ox.conf|docroot=/var/www/html/|loadmodule=LoadModule proxy_http_module modules/mod_proxy_http.so|syncProxyName=eas_oxcluster}}&lt;br /&gt;
&lt;br /&gt;
After the configuration is done, restart the Apache webserver&lt;br /&gt;
&lt;br /&gt;
 $ systemctl start httpd&lt;br /&gt;
&lt;br /&gt;
== Apache Setting for more concurrent Connections ==&lt;br /&gt;
&lt;br /&gt;
By default apache2 is configured to support 150 concurrent connections. This forces all parallel requests beyond that limit to wait. Especially if, for example, active sync clients maintain a permanent connection for push events to arrive. The following article explains how that can be done&lt;br /&gt;
&lt;br /&gt;
[[Tune_apache2_for_more_concurrent_connections|Apache Setting for more concurrent Connections]]&lt;br /&gt;
&lt;br /&gt;
= Adding services to runlevels =&lt;br /&gt;
&lt;br /&gt;
The new services are now installed and configured, but to make them start up on a server boot, they need to be added to some runlevels:&lt;br /&gt;
&lt;br /&gt;
 $ systemctl enable mariadb&lt;br /&gt;
 $ systemctl enable httpd&lt;br /&gt;
 $ systemctl enable open-xchange&lt;br /&gt;
&lt;br /&gt;
{{ContextUserAndLogs}}&lt;br /&gt;
&lt;br /&gt;
= Installing Open-Xchange Update packages =&lt;br /&gt;
&lt;br /&gt;
Please read [[UpdatingOXPackages]] on how to get access to the latest Open-Xchange packages.&lt;br /&gt;
&lt;br /&gt;
[[Category: AppSuite]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Documents_Installation_Guide_7103&amp;diff=24729</id>
		<title>AppSuite:Documents Installation Guide 7103</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Documents_Installation_Guide_7103&amp;diff=24729"/>
		<updated>2019-06-13T17:25:32Z</updated>

		<summary type="html">&lt;p&gt;Marens: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version|7.10.3}}&lt;br /&gt;
&lt;br /&gt;
= Download &amp;amp; Installation OX Documents =&lt;br /&gt;
&lt;br /&gt;
=== General Information ===&lt;br /&gt;
&lt;br /&gt;
OX Documents are browser based, cloud ready, text, spreadsheet and presentation products that can work with Microsoft Office and OpenOffice documents in a lossless way. And you can also collaborate with other people to edit shared documents on various devices.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
See the [[AppSuite:OX_System_Requirements|Open-Xchange software requirements page]] for details.&lt;br /&gt;
&lt;br /&gt;
OX Documents needs to be installed in an OX App Suite configuration with a [[AppSuite:Grizzly|backend based on Grizzly]] (including hazelcast as installed and activated by default).&lt;br /&gt;
&lt;br /&gt;
For compatibility with the legacy MS binary format files (.DOC, .XLS, .PPT) and for printing functionality in OX Text the document converter components (incl. readerengine) are required. These are not available in the Community Version of OX AppSuite.&lt;br /&gt;
&lt;br /&gt;
== Mandatory Modules ==&lt;br /&gt;
&lt;br /&gt;
Additional functional modules need to be installed separately: &lt;br /&gt;
&lt;br /&gt;
* The Document Converter API: See [[AppSuite:DocumentConverterAPIInstall|Document converter API installation instructions]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The OX Documents deployment consists of the packages &amp;lt;tt&amp;gt;open-xchange-documents-backend&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;open-xchange-documents-ui&amp;lt;/tt&amp;gt;. The &amp;lt;tt&amp;gt;open-xchange-documents-backend&amp;lt;/tt&amp;gt; package also requires and installs these packages:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;open-xchange-file-distribution&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;open-xchange-sessionstorage-hazelcast&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following Packages are no longer needed (since 7.10.3)&lt;br /&gt;
* &amp;lt;tt&amp;gt;open-xchange-realtime-core&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;open-xchange-realtime-json&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Redhat Enterprise Linux 6 or CentOS 6 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=rhelname|pc2v=RHEL6|office|office-web|documentconverter-api}}&lt;br /&gt;
&lt;br /&gt;
if you have a valid maintenance subscription, please add also following repositories by replacing the credentials.&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=rhelname|pc2v=RHEL6|pc3n=ldbaccount|pc3v=LDBUSER:LDBPASSWORD|office/updates|office-web/updates|documentconverter-api/updates}}&lt;br /&gt;
 $ yum install open-xchange-documents-backend open-xchange-documents-ui open-xchange-documents-ui-static&lt;br /&gt;
&lt;br /&gt;
=== Redhat Enterprise Linux 7 or CentOS 7 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=rhelname|pc2v=RHEL7|office|office-web|documentconverter-api}}&lt;br /&gt;
&lt;br /&gt;
if you have a valid maintenance subscription, please add also following repositories by replacing the credentials.&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=rhelname|pc2v=RHEL7|pc3n=ldbaccount|pc3v=LDBUSER:LDBPASSWORD|office/updates|office-web/updates|documentconverter-api/updates}}&lt;br /&gt;
&lt;br /&gt;
 $ yum install open-xchange-documents-backend open-xchange-documents-ui open-xchange-documents-ui-static&lt;br /&gt;
&lt;br /&gt;
=== Debian GNU/Linux 8.0 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange apt configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=debianname|pc2v=DebianJessie|office|office-web|documentconverter-api}}&lt;br /&gt;
&lt;br /&gt;
if you have a valid maintenance subscription, please add also following repositories by replacing the credentials.&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=debianname|pc2v=DebianJessie|pc3n=ldbaccount|pc3v=LDBUSER:LDBPASSWORD|office/updates|office-web/updates|documentconverter-api/updates}}&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get install open-xchange-documents-backend open-xchange-documents-ui open-xchange-documents-ui-static&lt;br /&gt;
&lt;br /&gt;
=== Debian GNU/Linux 9.0 (valid from v7.10) ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange apt configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=debianname|pc2v=DebianStretch|office|office-web|documentconverter-api}}&lt;br /&gt;
&lt;br /&gt;
if you have a valid maintenance subscription, please add also following repositories by replacing the credentials.&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=debianname|pc2v=DebianStretch|pc3n=ldbaccount|pc3v=LDBUSER:LDBPASSWORD|office/updates|office-web/updates|documentconverter-api/updates}}&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get install open-xchange-documents-backend open-xchange-documents-ui open-xchange-documents-ui-static&lt;br /&gt;
&lt;br /&gt;
=== SUSE Linux Enterprise Server 12 === &lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=SUSERepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=susename|pc2v=SLE_12|office|office-web|documentconverter-api}}&lt;br /&gt;
&lt;br /&gt;
if you have a valid maintenance subscription, please add also following repositories by replacing the credentials.&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=SUSERepo|pv=reponame|pc1n=path|pc1v=products/appsuite/stable|pc2n=susename|pc2v=SLE_12|pc3n=ldbaccount|pc3v=LDBUSER:LDBPASSWORD|office/updates|office-web/updates|documentconverter-api/updates}}&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
 $ zypper install open-xchange-documents-backend open-xchange-documents-ui open-xchange-documents-ui-static&lt;br /&gt;
&lt;br /&gt;
=== Univention Corporate Server ===&lt;br /&gt;
&lt;br /&gt;
OX Text for OX App Suite for UCS is available in the Univention App Center. Please check the UMC module App Center for the installation of the OX Documents at your already available environment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Documents Collaboration Service ==&lt;br /&gt;
&lt;br /&gt;
With 7.10.3 the Documents Collaboration Service has been introduced.&lt;br /&gt;
&lt;br /&gt;
The Documents Collaboration Service needs to be installed, configured and run. It supports collaboration across Middleware nodes but is also mandatory for a small (even single node) environments.&lt;br /&gt;
The server can be run as one additional service (JVM) or for larger deployments several instances can be clustered.&lt;br /&gt;
The implementation is based on Spring Boot and uses the Java-based messaging server Apache ActiveMQ.&lt;br /&gt;
&lt;br /&gt;
Note:&amp;lt;/br&amp;gt;&lt;br /&gt;
For upgrades from earlier versions than 7.10.2 the hazelcast cluster requires a complete shutdown, since the internal OX Documents data has changed. A rolling upgrade is not possible.&lt;br /&gt;
&lt;br /&gt;
=== Documents Collaboration Server (DCS) ===&lt;br /&gt;
&lt;br /&gt;
prepare documents-collaboration repo as described above.&lt;br /&gt;
&lt;br /&gt;
The DCS will be installed via the package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open-xchange-documents-collaboration-server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Target directory is &amp;lt;b&amp;gt;/usr/share/open-xchange-documents-collaboration&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration file is &amp;lt;b&amp;gt;/etc/documents-collaboration/dcs.properties&amp;lt;/b&amp;gt;. The following entries need to be reviewed and values adjusted to the setup.&amp;lt;br&amp;gt;&lt;br /&gt;
Configure bind host IP and JMS Port to listen to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dcs.host = 192.168.10.2       # Interface of the DCS node&lt;br /&gt;
dcs.port = 61616&lt;br /&gt;
&amp;lt;/pre&amp;gt;           &lt;br /&gt;
&lt;br /&gt;
A DCS writes its connection data to a database for discovery by middleware nodes&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
db.host=192.168.10.172&lt;br /&gt;
db.port=3306&lt;br /&gt;
db.schema=dcsdb&lt;br /&gt;
db.username=&amp;lt;db_user&amp;gt;&lt;br /&gt;
db.password=&amp;lt;db_password&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For management of DCS hosts the database used by the middleware can be configured.&lt;br /&gt;
&lt;br /&gt;
The default logging path is set in //etc//documents-collaboration/logback-spring.xml and points to //var//log//open-xchange//documents-collaboration//documents-collaboration.log&lt;br /&gt;
&lt;br /&gt;
The DCS Service will be started with &lt;br /&gt;
systemctl start open-xchange-documents-collaboration.service&lt;br /&gt;
&lt;br /&gt;
A command line tool allows to check the values in the database&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# /usr/share/open-xchange-documents-collaboration/bin/documents-collaboration-admin.sh -l&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
| ID                  | Host          | Interface     | JMSPort |&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
| 192.168.10.25:61616 | 192.168.10.25 | 192.168.10.25 |   61616 |&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middleware node===&lt;br /&gt;
&lt;br /&gt;
no new pkg repo, no new pkgs required for middleware&lt;br /&gt;
&lt;br /&gt;
Discovery of the DCS service is configured in &amp;lt;b&amp;gt;documents-collaboration-client.properties&amp;lt;/b&amp;gt;.&lt;br /&gt;
Add the appropriate values to access the dcsdb Database as set for the DCS above:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
com.openexchange.dcs.client.database.connectionURL=jdbc:mysql://databasehost:3306/dcsdb&lt;br /&gt;
com.openexchange.dcs.client.database.userName=db_user&lt;br /&gt;
com.openexchange.dcs.client.database.password=db_password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A command line tool allows to check the values in the database&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ /opt/open-xchange/sbin/documents-collaboration-admin -l&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
| ID                  | Host          | Interface     | JMSPort |&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
| 192.168.10.25:61616 | 192.168.10.25 | 192.168.10.25 |   61616 |&lt;br /&gt;
+---------------------+---------------+---------------+---------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Printing and legacy MS binary formats Editing ==&lt;br /&gt;
&lt;br /&gt;
For .DOC/.XLS/.PPT and/or printing support from OX Documents the Document Converter and readerengine components have to be installed separately (license key required)&lt;br /&gt;
&lt;br /&gt;
* See [[AppSuite:DocumentConverterInstall|Document converter / readerengine installation instructions]]&lt;br /&gt;
&lt;br /&gt;
== Monitoring ==&lt;br /&gt;
&lt;br /&gt;
OX Documents offers runtime information via JMX about the document editors as well as the OX Documentconverter. This [[AppSuite:DocumentsMonitoring|article]] guides to the information how to access JMX data, configure and use Jolokia and integrate with munin.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Permissions ===&lt;br /&gt;
&lt;br /&gt;
To enable the OX Documents Applications for OX Drive the associated permission has to be set.&lt;br /&gt;
&lt;br /&gt;
The default setting for all users is changed in the file '''documents.properties''' in the directory ''/opt/open-xchange/etc''.&lt;br /&gt;
&lt;br /&gt;
After installation the functionality is disabled:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Enables or disables the &amp;quot;text&amp;quot; module capability globally.&lt;br /&gt;
# com.openexchange.capability.text=true&lt;br /&gt;
&lt;br /&gt;
# Enables or disables the &amp;quot;spreadsheet&amp;quot; module capability globally.&lt;br /&gt;
# com.openexchange.capability.spreadsheet=true&lt;br /&gt;
&lt;br /&gt;
# Enables or disables the &amp;quot;presentation&amp;quot; module capability globally.&lt;br /&gt;
# com.openexchange.capability.presentation=true&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following line enables the functionality:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Enables or disables the &amp;quot;text&amp;quot; module capability globally.&lt;br /&gt;
com.openexchange.capability.text=true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with 7.6.2, you can disable the text portal app. In '''permissions.properties''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
permissions=textportaldisabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Collaboration on shared documents ===&lt;br /&gt;
&lt;br /&gt;
If OX Documents functionality is used for guest users in a cluster of application servers, this setting needs to be adjusted to false in order to also have guest sessions available in the distributed storage.&lt;br /&gt;
&lt;br /&gt;
in ''/opt/open-xchange/etc/sharing.properties'' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Specifies whether guest sessions are treated as transient or not. Transient&lt;br /&gt;
# sessions are only held in the short-term session containers, and are not put&lt;br /&gt;
# into the distributed session storage. Defaults to &amp;quot;true&amp;quot;.&lt;br /&gt;
com.openexchange.share.transientSessions=false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
com.openechange.share.transientSessions has to be set to false.&lt;br /&gt;
&lt;br /&gt;
=== Spell Checking===&lt;br /&gt;
&lt;br /&gt;
OX Text and OX Presentation use ''hunspell'' for spell checking functionality.&lt;br /&gt;
By default Spellchecking is enabled in ''/opt/open-xchange/etc/settings/office.properties''&lt;br /&gt;
with the following entry&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Determines whether online spelling is enabled for office documents.&lt;br /&gt;
# Possible values: true|false&lt;br /&gt;
# If this property is missing true is taken.&lt;br /&gt;
io.ox/office//module/spellingEnabled=true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After installation of the ''hunspell'' package for your platform the shared library and the US English dictionaries are available. Please check the file location the pkg files were installed into. (For instance on CentOS, use rpm -q –filesbypkg hunspell and verify the path of the lib files to be configured below)&lt;br /&gt;
Also verify that the Hunspell dictonary is present and not renamed to &amp;quot;myspell&amp;quot; etc.. if the dictionary is renamed, you will have to use that in the config below. &lt;br /&gt;
&lt;br /&gt;
Additional dictionaries are published for your platform as packages hunspell-de-de,  hunspell-fr, ...&lt;br /&gt;
&lt;br /&gt;
Spell checking has to be configured in the file ''/opt/open-xchange/etc/hunspell.properties''.&lt;br /&gt;
The values for the shared library file and dictionary path have to be set according to the platform.&lt;br /&gt;
&lt;br /&gt;
This example shows the values for Debian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The name and location of the hunspell library&lt;br /&gt;
# Default value: &amp;quot;/usr/lib/x86_64-linux-gnu/libhunspell-1.3.so.0&amp;quot;&lt;br /&gt;
com.openexchange.spellchecker.hunspell.library=/usr/lib/x86_64-linux-gnu/libhunspell-1.4.so.0&lt;br /&gt;
# The location of the dictionaries&lt;br /&gt;
# Default value: &amp;quot;/usr/share/hunspell&amp;quot;&lt;br /&gt;
com.openexchange.spellchecker.hunspell.dictionaries=/usr/share/hunspell&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If spellchecking is enabled and the library path or dictionary path is wrong a warning is logged.&lt;br /&gt;
&lt;br /&gt;
If a language is not supported by a hunspell dictionary (or produces error messages in the console log) myspell dictionaries are a working alternative.&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
OX Documents support different levels to provide document templates for users.&lt;br /&gt;
&lt;br /&gt;
A number of ready-to-use templates for letters, memos, resumes, home budget, presentations, etc is included with the system. These templates are made available in a directory at each system node by installation of the package open-xchange-documents-templates. The path to this directory is defined in the office.properties file &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Defines the absolute path where document templates are located inside the local (!) file system.&lt;br /&gt;
# The templates are displayed in the documents applications.&lt;br /&gt;
# If this property is missing a default '/opt/open-xchange/templates/documents' is taken.&lt;br /&gt;
io.ox/office//module/templatePath = /opt/open-xchange/templates/documents&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The content in the directory specified by the path must comply to the following rules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/open-xchange/templates/documents     &lt;br /&gt;
|     &lt;br /&gt;
----&amp;gt; text [application type]&lt;br /&gt;
|     |   &lt;br /&gt;
|     ----&amp;gt; en-US [language-region]&lt;br /&gt;
|     |     &lt;br /&gt;
|     ----&amp;gt; en [language fallback, en is also fallback for all other non-convered languages]&lt;br /&gt;
|     |     &lt;br /&gt;
|     ----&amp;gt; de-DE&lt;br /&gt;
|     |     &lt;br /&gt;
|     ----&amp;gt; de&lt;br /&gt;
|     |     &lt;br /&gt;
|     ----&amp;gt; common [language independent, used in addition to the language specific ones]&lt;br /&gt;
|         &lt;br /&gt;
----&amp;gt; spreadsheet&lt;br /&gt;
|         &lt;br /&gt;
----&amp;gt; presentation&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A context administrator can additionally provide global templates for all users in the same context.&lt;br /&gt;
If logged in with this role folders can be added to or removed from the list of global template folders. For regular users the list is displayed without the permission to modify it.&lt;br /&gt;
&lt;br /&gt;
[[File:template-folder.png|border|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Users can create and manage their own templates. These user templates are stored and retrieved from the user’s root folder (“My files”). In addition to the root folder the user can define more template folders, sub-folders or even external folders in the “Documents” section of the “Settings” menu. This helps to organize templates and allows cleanup of the root folder by removal of templates.&lt;br /&gt;
&lt;br /&gt;
For installations of OX Spreadsheet based on Appsuite 7.8.0 and 7.8.1 please see [http://oxpedia.org/wiki/index.php?title=AppSuite:Spreadsheet_Installation_Guide_7_8_1 here] for different installation modes.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Mobile_API_Facade&amp;diff=23536</id>
		<title>AppSuite:Mobile API Facade</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Mobile_API_Facade&amp;diff=23536"/>
		<updated>2017-07-10T08:22:48Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Proxy configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OX Facade for Mobile =&lt;br /&gt;
&lt;br /&gt;
== General Information ==&lt;br /&gt;
&lt;br /&gt;
The Mobile API Facade is a server component that brings the new native mobile mail apps together with the OX App Suite. We’ve built the façade based on the technology used and proven in the OX App Suite middleware. The facade is developed in Java, utilizing the OSGI Framework.&lt;br /&gt;
&lt;br /&gt;
The Facade provides offline friendly HTTP interface by doing the work, the connections through the HTTP API, to the OX App Suite and providing only the data the offline capable clients need. In some cases multiple requests to the OX App Suite are combined into one for its clients.The facade also offers a method to tell the clients that information on the server haven’t changed since the last time the client asked for it. This reduces the amount of data to transmit to the clients under certain circumstances, especially important in mobile networks were bandwidth (and overall traffic) is limited. Thanks to facade some functionality can be shared among all clients and need only get implemented once. One example for this is the teaser text extraction, and HTML mail handling in general.The facade also provides a pluggable authentication system. In the default case, login request are just forwarded to the middleware. In more advanced use-cases, the login request is forwarded to IDM of the customer and an OX session is created from the access token from the IDM. For clients this is pretty straightforward.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
The OX Facade has to be installed alongside an OX App Suite installation. It requires at least OX App Suite v7.8.4.&lt;br /&gt;
&lt;br /&gt;
== OX Facade API ==&lt;br /&gt;
&lt;br /&gt;
Further information about the OX Facade API can be found at:&lt;br /&gt;
https://documentation.open-xchange.com/components/facade/1.0.0/&lt;br /&gt;
&lt;br /&gt;
= OX Mail Server-side Installation and Configuration on OX App Suite v7.8.x =&lt;br /&gt;
&lt;br /&gt;
This chapter describes how the backend components of OX Mail are installed and configured on the server.&lt;br /&gt;
&lt;br /&gt;
== Available packages ==&lt;br /&gt;
&lt;br /&gt;
OX Facade is available with the following backend packages:&lt;br /&gt;
&lt;br /&gt;
* ''open-xchange-mobile-api-facade''&lt;br /&gt;
&lt;br /&gt;
Installation on the server varies depending on the underlying distribution, details are available in the following chapters.&lt;br /&gt;
&lt;br /&gt;
=== Redhat Enterprise Linux 6 or CentOS 6 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=rhelname|pc2v=RHEL6|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ yum install open-xchange-mobile-api-facade&lt;br /&gt;
 &lt;br /&gt;
=== Redhat Enterprise Linux 7 or CentOS 7 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=rhelname|pc2v=RHEL7|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ yum install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
=== Debian GNU/Linux 8.0 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange apt configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=debianname|pc2v=DebianJessie|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
=== SUSE Linux Enterprise Server 12 === &lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=SUSERepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=susename|pc2v=SLE_12|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
 $ zypper install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
= Configuration OX Facade for Mobile =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To be able to use the native mail apps the Mobile API Facade needs to be installed in front of the OX App Suite middleware. This document describes how to configure the Mobile API Facade.&lt;br /&gt;
&lt;br /&gt;
The Mobile API Facade stores its configuration in the files &amp;lt;code&amp;gt;/opt/open-xchange/mobile-api-facade/etc/facade.properties&amp;lt;/code&amp;gt; (the global configuration) and in &amp;lt;code&amp;gt;/opt/open-xchange/mobile-api-facade/etc/mobile-api-facade-config.yml&amp;lt;/code&amp;gt; (hostname specific configuration). Both files support the same configuration properties as can be seen on https://documentation.open-xchange.com/components/facade/config/1.0.0/.&lt;br /&gt;
&lt;br /&gt;
== Connection to the OX App Suite Middleware ==&lt;br /&gt;
&lt;br /&gt;
After installation of the facade package (&amp;quot;open-xchange-mobile-api-facade&amp;quot;) the property &amp;lt;code&amp;gt;com.openexchange.mobile.api.facade.MiddlewareBaseUrl&amp;lt;/code&amp;gt; needs to get set to the correct URL. This property needs to be explicitly configured by the administrator. It has no default value. Its possible to connect the Mobile API Facade directly to a middleware process, but this is highly discouraged. The Mobile API Facade should always connect to a middleware process through a load balancer.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&lt;br /&gt;
 com.openexchange.mobile.api.facade.MiddlewareBaseUrl=https://appsuite.example.com/appsuite/api&lt;br /&gt;
&lt;br /&gt;
After this configuration the open-xchange-mobile-api-facade needs to get restarted.&lt;br /&gt;
&lt;br /&gt;
== Proxy configuration ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Proxy balancer://oxcluster_facade&amp;gt;&lt;br /&gt;
         Order Allow,Deny&lt;br /&gt;
         Allow from all&lt;br /&gt;
         BalancerMember http://appsuite-middleware1.example.com:8007 timeout=100 smax=0 ttl=60 retry=60 &lt;br /&gt;
 loadfactor=50 keepalive=On route=FOX1&lt;br /&gt;
         BalancerMember http://appsuite-middleware2.example.com:8007 timeout=100 smax=0 ttl=60 retry=60 &lt;br /&gt;
 loadfactor=50 keepalive=On route=FOX2&lt;br /&gt;
 &lt;br /&gt;
         ProxySet stickysession=JSESSIONID|jsessionidscolonpathdelim=On&lt;br /&gt;
         SetEnv proxy-initial-not-pooled&lt;br /&gt;
         SetEnv proxy-sendchunked&lt;br /&gt;
 &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ProxyPass /services/api-facade balancer://oxcluster_facade/services/api-facade&lt;br /&gt;
&lt;br /&gt;
== Traffic compression ==&lt;br /&gt;
&lt;br /&gt;
The clients need to exchange a lot of data with the facade to accomplish the task of a mail client. This traffic can be compressed. Clients add the header &amp;quot;Accept-Encoding: gzip,deflate&amp;quot; by default. For this to work the Apache web server in front of the facade needs to handle this as the facade itself is not returning compressed response bodies.&lt;br /&gt;
&lt;br /&gt;
For Apache HTTPD &amp;lt;code&amp;gt;{mod_deflate}&amp;lt;/code&amp;gt; needs to be enabled and the following line needs to be added to your virtual host:&lt;br /&gt;
&lt;br /&gt;
 AddOutputFilterByType DEFLATE text/html text/plain text/javascript application/javascript text/css &lt;br /&gt;
 text/xml application/xml text/x-js application/x-javascript application/json&lt;br /&gt;
&lt;br /&gt;
== Starting/Stopping the Facade Service ==&lt;br /&gt;
&lt;br /&gt;
The facade runs as its own service independent of the normal OX App Suite middleware. For this on Debian-based system it can be started with&lt;br /&gt;
&lt;br /&gt;
 service open-xchange-mobile-api-facade start&lt;br /&gt;
&lt;br /&gt;
It can be stopped with&lt;br /&gt;
&lt;br /&gt;
 service open-xchange-mobile-api-facade stop&lt;br /&gt;
&lt;br /&gt;
== Ports ==&lt;br /&gt;
&lt;br /&gt;
As the Mobile API Facade is its own process it also has its own JMX port and its own RMI port. The default JMX port is 9995 and the default RMI port is 1100. These ports needs to be explicitly specified to the command line tools using either JMX or RMI.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Mobile_API_Facade&amp;diff=23535</id>
		<title>AppSuite:Mobile API Facade</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Mobile_API_Facade&amp;diff=23535"/>
		<updated>2017-07-10T08:21:41Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Proxy configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OX Facade for Mobile =&lt;br /&gt;
&lt;br /&gt;
== General Information ==&lt;br /&gt;
&lt;br /&gt;
The Mobile API Facade is a server component that brings the new native mobile mail apps together with the OX App Suite. We’ve built the façade based on the technology used and proven in the OX App Suite middleware. The facade is developed in Java, utilizing the OSGI Framework.&lt;br /&gt;
&lt;br /&gt;
The Facade provides offline friendly HTTP interface by doing the work, the connections through the HTTP API, to the OX App Suite and providing only the data the offline capable clients need. In some cases multiple requests to the OX App Suite are combined into one for its clients.The facade also offers a method to tell the clients that information on the server haven’t changed since the last time the client asked for it. This reduces the amount of data to transmit to the clients under certain circumstances, especially important in mobile networks were bandwidth (and overall traffic) is limited. Thanks to facade some functionality can be shared among all clients and need only get implemented once. One example for this is the teaser text extraction, and HTML mail handling in general.The facade also provides a pluggable authentication system. In the default case, login request are just forwarded to the middleware. In more advanced use-cases, the login request is forwarded to IDM of the customer and an OX session is created from the access token from the IDM. For clients this is pretty straightforward.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
The OX Facade has to be installed alongside an OX App Suite installation. It requires at least OX App Suite v7.8.4.&lt;br /&gt;
&lt;br /&gt;
== OX Facade API ==&lt;br /&gt;
&lt;br /&gt;
Further information about the OX Facade API can be found at:&lt;br /&gt;
https://documentation.open-xchange.com/components/facade/1.0.0/&lt;br /&gt;
&lt;br /&gt;
= OX Mail Server-side Installation and Configuration on OX App Suite v7.8.x =&lt;br /&gt;
&lt;br /&gt;
This chapter describes how the backend components of OX Mail are installed and configured on the server.&lt;br /&gt;
&lt;br /&gt;
== Available packages ==&lt;br /&gt;
&lt;br /&gt;
OX Facade is available with the following backend packages:&lt;br /&gt;
&lt;br /&gt;
* ''open-xchange-mobile-api-facade''&lt;br /&gt;
&lt;br /&gt;
Installation on the server varies depending on the underlying distribution, details are available in the following chapters.&lt;br /&gt;
&lt;br /&gt;
=== Redhat Enterprise Linux 6 or CentOS 6 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=rhelname|pc2v=RHEL6|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ yum install open-xchange-mobile-api-facade&lt;br /&gt;
 &lt;br /&gt;
=== Redhat Enterprise Linux 7 or CentOS 7 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange yum configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=YUMRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=rhelname|pc2v=RHEL7|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ yum install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
=== Debian GNU/Linux 8.0 ===&lt;br /&gt;
&lt;br /&gt;
Add the following repositories to your Open-Xchange apt configuration:&lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=APTRepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=debianname|pc2v=DebianJessie|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
=== SUSE Linux Enterprise Server 12 === &lt;br /&gt;
&lt;br /&gt;
 {{for loop||call=SUSERepo|pv=reponame|pc1n=path|pc1v=products/mobile-api-facade/stable|pc2n=susename|pc2v=SLE_12|mobile-api-facade}}&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
 $ zypper install open-xchange-mobile-api-facade&lt;br /&gt;
&lt;br /&gt;
= Configuration OX Facade for Mobile =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To be able to use the native mail apps the Mobile API Facade needs to be installed in front of the OX App Suite middleware. This document describes how to configure the Mobile API Facade.&lt;br /&gt;
&lt;br /&gt;
The Mobile API Facade stores its configuration in the files &amp;lt;code&amp;gt;/opt/open-xchange/mobile-api-facade/etc/facade.properties&amp;lt;/code&amp;gt; (the global configuration) and in &amp;lt;code&amp;gt;/opt/open-xchange/mobile-api-facade/etc/mobile-api-facade-config.yml&amp;lt;/code&amp;gt; (hostname specific configuration). Both files support the same configuration properties as can be seen on https://documentation.open-xchange.com/components/facade/config/1.0.0/.&lt;br /&gt;
&lt;br /&gt;
== Connection to the OX App Suite Middleware ==&lt;br /&gt;
&lt;br /&gt;
After installation of the facade package (&amp;quot;open-xchange-mobile-api-facade&amp;quot;) the property &amp;lt;code&amp;gt;com.openexchange.mobile.api.facade.MiddlewareBaseUrl&amp;lt;/code&amp;gt; needs to get set to the correct URL. This property needs to be explicitly configured by the administrator. It has no default value. Its possible to connect the Mobile API Facade directly to a middleware process, but this is highly discouraged. The Mobile API Facade should always connect to a middleware process through a load balancer.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&lt;br /&gt;
 com.openexchange.mobile.api.facade.MiddlewareBaseUrl=https://appsuite.example.com/appsuite/api&lt;br /&gt;
&lt;br /&gt;
After this configuration the open-xchange-mobile-api-facade needs to get restarted.&lt;br /&gt;
&lt;br /&gt;
== Proxy configuration ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Proxy balancer://oxcluster_facade&amp;gt;&lt;br /&gt;
         Order Allow,Deny&lt;br /&gt;
         Allow from all&lt;br /&gt;
         BalancerMember http://appsuite-middleware1.somedomain:8007 timeout=100 smax=0 ttl=60 retry=60 &lt;br /&gt;
 loadfactor=50 keepalive=On route=FOX1&lt;br /&gt;
         BalancerMember http://appsuite-middleware2.somedomain:8007 timeout=100 smax=0 ttl=60 retry=60 &lt;br /&gt;
 loadfactor=50 keepalive=On route=FOX2&lt;br /&gt;
 &lt;br /&gt;
         ProxySet stickysession=JSESSIONID|jsessionidscolonpathdelim=On&lt;br /&gt;
         SetEnv proxy-initial-not-pooled&lt;br /&gt;
         SetEnv proxy-sendchunked&lt;br /&gt;
 &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ProxyPass /services/api-facade balancer://oxcluster_facade/services/api-facade&lt;br /&gt;
&lt;br /&gt;
== Traffic compression ==&lt;br /&gt;
&lt;br /&gt;
The clients need to exchange a lot of data with the facade to accomplish the task of a mail client. This traffic can be compressed. Clients add the header &amp;quot;Accept-Encoding: gzip,deflate&amp;quot; by default. For this to work the Apache web server in front of the facade needs to handle this as the facade itself is not returning compressed response bodies.&lt;br /&gt;
&lt;br /&gt;
For Apache HTTPD &amp;lt;code&amp;gt;{mod_deflate}&amp;lt;/code&amp;gt; needs to be enabled and the following line needs to be added to your virtual host:&lt;br /&gt;
&lt;br /&gt;
 AddOutputFilterByType DEFLATE text/html text/plain text/javascript application/javascript text/css &lt;br /&gt;
 text/xml application/xml text/x-js application/x-javascript application/json&lt;br /&gt;
&lt;br /&gt;
== Starting/Stopping the Facade Service ==&lt;br /&gt;
&lt;br /&gt;
The facade runs as its own service independent of the normal OX App Suite middleware. For this on Debian-based system it can be started with&lt;br /&gt;
&lt;br /&gt;
 service open-xchange-mobile-api-facade start&lt;br /&gt;
&lt;br /&gt;
It can be stopped with&lt;br /&gt;
&lt;br /&gt;
 service open-xchange-mobile-api-facade stop&lt;br /&gt;
&lt;br /&gt;
== Ports ==&lt;br /&gt;
&lt;br /&gt;
As the Mobile API Facade is its own process it also has its own JMX port and its own RMI port. The default JMX port is 9995 and the default RMI port is 1100. These ports needs to be explicitly specified to the command line tools using either JMX or RMI.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:UpdatingOXPackages&amp;diff=23266</id>
		<title>AppSuite:UpdatingOXPackages</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:UpdatingOXPackages&amp;diff=23266"/>
		<updated>2017-05-04T14:13:31Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Warnings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;Updating OX App Suite packages&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Synopsys'': This article describes how to update OX App Suite packages from one service pack to another.&lt;br /&gt;
&lt;br /&gt;
== Warnings ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, here are several things that you should keep in mind:&lt;br /&gt;
* If you are '''updating a cluster, please do it one node after the other'''. Turn the node off, update, turn it on again, make sure it works in the cluster. Have a look here, too: [[Running_a_cluster#Upgrading_a_single_Node|Upgrading a single node]]&lt;br /&gt;
* If you don't have a cluster of OX nodes, then your complete installation needs to be taken down temporarily.&lt;br /&gt;
* Please '''update the frontend before the backend'''. Otherwise the old frontend won't work with the new backend and it's manifests.&lt;br /&gt;
* Please '''do not restart Open-Xchange during the database update'''. A database update can happen after installing minor or major updates. As soon as the first user tries to log in to the system or if any provisioning action is done, this update starts.&lt;br /&gt;
&lt;br /&gt;
=== Upgrading to 7.8.4 ===&lt;br /&gt;
* During the upgrade to 7.8.4 the existing ''JAVA_XTRAOPTS'' configuration property of the middleware stack in the file ''ox-scriptconf.sh'' will automatically be split up and migrated to a new categories approach. Please have a look at [[AppSuite:MiddlewareStartup#Evaluate_JVM_commandline_options|JVM commandline options]] and review the automatically upgraded configuration file.&lt;br /&gt;
&lt;br /&gt;
== How to get updates? ==&lt;br /&gt;
&lt;br /&gt;
OX App Suite updates can be accessed by customers with a valid license.&lt;br /&gt;
&lt;br /&gt;
In addition, you need to configure the [[OXReportClient]].&lt;br /&gt;
&lt;br /&gt;
= Updating OX App Suite Packages =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing Updates ==&lt;br /&gt;
&lt;br /&gt;
A new service pack usually introduces new packages and requires configuration changes. To get all required new packages and configuration changes, the following '''must''' be done when installing updates.&lt;br /&gt;
&lt;br /&gt;
(Please, keep the [[#Warning|warning about frontend updates before backend updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
=== On Debian based distributions ===&lt;br /&gt;
&lt;br /&gt;
Add the following entry to &amp;lt;tt&amp;gt;/etc/apt/sources.list.d/open-xchange.list&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/DebianJessie/ /&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/backend/updates/DebianJessie /&lt;br /&gt;
Then run&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get dist-upgrade&lt;br /&gt;
&lt;br /&gt;
If you want to see, what apt-get is going to do without actually doing it, you can run:&lt;br /&gt;
&lt;br /&gt;
 $ apt-get dist-upgrade -s&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On RPM based distributions ===&lt;br /&gt;
&lt;br /&gt;
==== RHEL6/CentOS6 ====&lt;br /&gt;
&lt;br /&gt;
Add the following entries to &amp;lt;tt&amp;gt;/etc/yum.repos.d/ox.repo&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 [ox-updates-appsuiteui]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/RHEL6/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
 &lt;br /&gt;
 [ox-updates-backend]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL6/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ yum update&lt;br /&gt;
&lt;br /&gt;
 $ yum upgrade&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
==== RHEL7/CentOS7 ====&lt;br /&gt;
&lt;br /&gt;
Add the following entries to &amp;lt;tt&amp;gt;/etc/yum.repos.d/ox.repo&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 [ox-updates-appsuiteui]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/RHEL7/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
 &lt;br /&gt;
 [ox-updates-backend]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/backend/updates/RHEL7/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ yum update&lt;br /&gt;
&lt;br /&gt;
 $ yum upgrade&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
==== SLES12 ====&lt;br /&gt;
&lt;br /&gt;
Add the updates repository to the repository list:&lt;br /&gt;
&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/appsuiteui/updates/SLE_12/ OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/stable/backend/updates/SLE_12/ OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ zypper dup -r OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper dup -r OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
You might need to run&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
&lt;br /&gt;
to update the repository metadata before running ''zypper up''.&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ rcopen-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind.&lt;br /&gt;
&lt;br /&gt;
= Updating OX App Suite Packages for older versions =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing Updates ==&lt;br /&gt;
&lt;br /&gt;
A new service pack usually introduces new packages and requires configuration changes. To get all required new packages and configuration changes, the following '''must''' be done when installing updates.&lt;br /&gt;
&lt;br /&gt;
(Please, keep the [[#Warning|warning about frontend updates before backend updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
=== On Debian based distributions ===&lt;br /&gt;
&lt;br /&gt;
If you want to update an older version of Open-Xchange App Suite to the latest maintenance release, add the following entry to &amp;lt;tt&amp;gt;/etc/apt/sources.list.d/open-xchange.list&amp;lt;/tt&amp;gt;. Replace VERSION with the version you are using (e.g. 7.6.2). See [[AppSuite:Version_Support_Committment]] for the currently supported versions. Also, make sure that your repository configuration points at the versioned base installation repositories (instead of using the &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; symlink.)&lt;br /&gt;
&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/DebianWheezy/ /&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/DebianWheezy/ /&lt;br /&gt;
&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/DebianJessie/ /&lt;br /&gt;
 deb http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/DebianJessie /&lt;br /&gt;
&lt;br /&gt;
Then run&lt;br /&gt;
&lt;br /&gt;
 $ apt-get update&lt;br /&gt;
 $ apt-get dist-upgrade&lt;br /&gt;
&lt;br /&gt;
If you want to see, what apt-get is going to do without actually doing it, you can run:&lt;br /&gt;
&lt;br /&gt;
 $ apt-get dist-upgrade -s&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On RPM based distributions ===&lt;br /&gt;
&lt;br /&gt;
==== RHEL6/CentOS6 ====&lt;br /&gt;
&lt;br /&gt;
If you want to update an older version of Open-Xchange App Suite to the latest maintenance release, add the following entry to &amp;lt;tt&amp;gt;/etc/yum.repos.d/ox.repo&amp;lt;/tt&amp;gt;. Replace VERSION with the version you are using (e.g. 7.4.2, 7.6.0). See [[AppSuite:Version_Support_Committment]] for the currently supported versions. Also, make sure that your repository configuration points at the versioned base installation repositories (instead of using the &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; symlink.)&lt;br /&gt;
&lt;br /&gt;
 [ox-updates-appsuiteui]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/RHEL6/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
 &lt;br /&gt;
 [ox-updates-backend]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/RHEL6/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ yum update&lt;br /&gt;
&lt;br /&gt;
 $ yum upgrade&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
==== RHEL7/CentOS7 ====&lt;br /&gt;
&lt;br /&gt;
If you want to update an older version of Open-Xchange App Suite to the latest maintenance release, add the following entry to &amp;lt;tt&amp;gt;/etc/yum.repos.d/ox.repo&amp;lt;/tt&amp;gt;. Replace VERSION with the version you are using (e.g. 7.4.2, 7.6.0). See [[AppSuite:Version_Support_Committment]] for the currently supported versions. Also, make sure that your repository configuration points at the versioned base installation repositories (instead of using the &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; symlink.)&lt;br /&gt;
&lt;br /&gt;
 [ox-updates-appsuiteui]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/RHEL7/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
 &lt;br /&gt;
 [ox-updates-backend]&lt;br /&gt;
 name=Open-Xchange Updates&lt;br /&gt;
 baseurl=http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/RHEL7/&lt;br /&gt;
 gpgkey=http://software.open-xchange.com/oxbuildkey.pub&lt;br /&gt;
 enabled=1&lt;br /&gt;
 gpgcheck=1&lt;br /&gt;
 metadata_expire=0m&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ yum update&lt;br /&gt;
&lt;br /&gt;
 $ yum upgrade&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ /etc/init.d/open-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind)&lt;br /&gt;
&lt;br /&gt;
==== SLES 11 ====&lt;br /&gt;
&lt;br /&gt;
If you want to update an older version of Open-Xchange App Suite to the latest maintenance release, add the following entry to the repository list. Replace VERSION with the version you are using (e.g. 7.4.2, 7.6.0). See [[AppSuite:Version_Support_Committment]] for the currently supported versions. Also, make sure that your repository configuration points at the versioned base installation repositories (instead of using the &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; symlink.)&lt;br /&gt;
&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/SLES11/ OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/SLES11/ OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ zypper dup -r OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper dup -r OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
You might need to run&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
&lt;br /&gt;
to update the repository metadata before running ''zypper up''.&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ rcopen-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind.&lt;br /&gt;
&lt;br /&gt;
==== SLES 12 ====&lt;br /&gt;
&lt;br /&gt;
If you want to update an older version of Open-Xchange App Suite to the latest maintenance release, add the following entry to the repository list. Replace VERSION with the version you are using (e.g. 7.4.2, 7.6.0). See [[AppSuite:Version_Support_Committment]] for the currently supported versions. Also, make sure that your repository configuration points at the versioned base installation repositories (instead of using the &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; symlink.)&lt;br /&gt;
&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/appsuiteui/updates/SLE_12/ OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper ar http://CUSTOMERID:PASSWORD@software.open-xchange.com/products/appsuite/VERSION/backend/updates/SLE_12/ OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
and run&lt;br /&gt;
&lt;br /&gt;
 $ zypper dup -r OXAPPSUITEUIUPDATES&lt;br /&gt;
 $ zypper dup -r OXBACKENDUPDATES&lt;br /&gt;
&lt;br /&gt;
You might need to run&lt;br /&gt;
&lt;br /&gt;
 $ zypper ref&lt;br /&gt;
&lt;br /&gt;
to update the repository metadata before running ''zypper up''.&lt;br /&gt;
&lt;br /&gt;
After the new packages are installed, the open-xchange process needs a restart:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;$ rcopen-xchange restart&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Please, keep the [[#Warnings|warning about database updates]] in mind.&lt;br /&gt;
&lt;br /&gt;
= Updating UI plugins =&lt;br /&gt;
&lt;br /&gt;
If you update only UI plugins without simultaneously upgrading the core UI packages to a new version, you need to perform an additional step after the update to make the changes visible to users.&lt;br /&gt;
&lt;br /&gt;
The package &amp;lt;tt&amp;gt;open-xchange-appsuite&amp;lt;/tt&amp;gt; contains a timestamp which is different in each version. The JavaScript UI in every user's browser will reload all cached code and data whenever this value changes. Since this value does not change when updating only plugin packages, the value must be changed manually with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /opt/open-xchange/sbin/touch-appsuite --timestamp=20170101.123400&lt;br /&gt;
&lt;br /&gt;
If you only have one OX node, the parameter &amp;lt;code&amp;gt;--timestamp&amp;lt;/code&amp;gt; can be omitted. It defaults to the current UTC time anyway.&lt;br /&gt;
&lt;br /&gt;
When updating a cluster, the command must use the same timestamp value on every node. Otherwise, browsers will clear their cache and re-download the entire UI code every time load balancer sends them to a different node (i.e. on almost every login). This is also why the timestamps can't be updated automatically: a node doesn't know which value other nodes will pick, which of them are part of the same update, etc.&lt;br /&gt;
&lt;br /&gt;
The quickest way to obtain a value for the timestamp parameter is to run the command with the parameter &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;. It will then print a help message with the current time as an example. For automation, you can use the output of&lt;br /&gt;
&lt;br /&gt;
 date -u +%Y%m%d.%H%M%S&lt;br /&gt;
&lt;br /&gt;
Again: this value must be computed once, and then the same value must be used on every node in the cluster.&lt;br /&gt;
&lt;br /&gt;
This step can be performed on each node separately after each node has been updated, or on all nodes at once after all nodes have been updated. If Apache has its own set of dedicated nodes, the &amp;lt;tt&amp;gt;touch-appsuite&amp;lt;/tt&amp;gt; call must be performed on the web server nodes, after all corresponding &amp;lt;tt&amp;gt;&amp;lt;plugin&amp;gt;-static&amp;lt;/tt&amp;gt; packages have been updated.&lt;br /&gt;
&lt;br /&gt;
[[Category: OX7]]&lt;br /&gt;
[[Category: AppSuite]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Administrator]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23247</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23247"/>
		<updated>2017-04-26T16:52:24Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Format &amp;gt;= 7.8.4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read and maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operation the Open-Xchange middleware does, some parts of the JVM don't allow to specify the encoding to use and simply falls back to the detected default encoding. That's why '''admins have to make sure to provide a proper unicode environment for the middleware service during every service start''' or use documented workarounds provided by Open-Xchange (e.g. [http://documentation.open-xchange.com/components/middleware/config/develop/index.html#mode=features&amp;amp;feature=Password%20Change%20Script com.openexchange.passwordchange.script.base64]: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions).&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]#&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23246</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23246"/>
		<updated>2017-04-26T08:20:05Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Verify that your system is configured with a proper unicode locale for OX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operation the Open-Xchange middleware does, some parts of the JVM don't allow to specify the encoding to use and simply falls back to the detected default encoding. That's why '''admins have to make sure to provide a proper unicode environment for the middleware service during every service start''' or use documented workarounds provided by Open-Xchange (e.g. [http://documentation.open-xchange.com/components/middleware/config/develop/index.html#mode=features&amp;amp;feature=Password%20Change%20Script com.openexchange.passwordchange.script.base64]: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions).&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]#&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23245</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23245"/>
		<updated>2017-04-26T08:19:41Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Verify that your system is configured with a proper unicode locale for OX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operation the Open-Xchange middleware does, some parts of the JVM don't allow to specify the encoding to use and simply falls back to the detected default encoding. That's why '''admins have to make sure to provide a proper unicode environment for the middleware service during every service start''' or use documented workarounds provided by Open-Xchange (e.g. [http://documentation.open-xchange.com/components/middleware/config/develop/index.html#mode=features&amp;amp;feature=Password%20Change%20Script com.openexchange.passwordchange.script.base64]: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions).&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant] locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23244</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23244"/>
		<updated>2017-04-26T08:06:13Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operation the Open-Xchange middleware does, some parts of the JVM don't allow to specify the encoding to use and simply falls back to the detected default encoding. That's why '''admins have to make sure to provide a proper unicode environment for the middleware service during every service start''' or use documented workarounds provided by Open-Xchange (e.g. [http://documentation.open-xchange.com/components/middleware/config/develop/index.html#mode=features&amp;amp;feature=Password%20Change%20Script com.openexchange.passwordchange.script.base64]: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions).&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23243</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23243"/>
		<updated>2017-04-26T08:04:05Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. [http://documentation.open-xchange.com/components/middleware/config/develop/index.html#mode=features&amp;amp;feature=Password%20Change%20Script com.openexchange.passwordchange.script.base64]: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions).&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23242</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23242"/>
		<updated>2017-04-25T12:31:37Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Query which file encoding was detected by the JVM during startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. com.openexchange.passwordchange.script.base64: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions see [https://documentation.open-xchange.com/7.8.3/middleware/configuration/properties.html property documentation])&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value='''UTF-8'''}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23241</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23241"/>
		<updated>2017-04-25T08:59:50Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Limits besides control groups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]. ''Again'': The complete documentation wrt. resource limit configurations in drop-in configs can be found at [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. com.openexchange.passwordchange.script.base64: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions see [https://documentation.open-xchange.com/7.8.3/middleware/configuration/properties.html property documentation])&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23240</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23240"/>
		<updated>2017-04-25T08:57:43Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Drop-in configs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The [https://www.freedesktop.org/software/systemd/man/systemd.exec.html systemd.exec] documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. com.openexchange.passwordchange.script.base64: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions see [https://documentation.open-xchange.com/7.8.3/middleware/configuration/properties.html property documentation])&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23239</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23239"/>
		<updated>2017-04-25T08:51:36Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Drop-in configs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note:'' The technical implementation of systemd differs as service definition and config aren't read every time during service start but the changes need to be reread with ''systemctl daemon-reload''. The above is just a simplyfied version to explain the general concept.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. com.openexchange.passwordchange.script.base64: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions see [https://documentation.open-xchange.com/7.8.3/middleware/configuration/properties.html property documentation])&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23238</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23238"/>
		<updated>2017-04-24T21:46:51Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. com.openexchange.passwordchange.script.base64: Encoded strings as Base64 to circumvent character encoding issues on improperly configured distributions see [https://documentation.open-xchange.com/7.8.3/middleware/configuration/properties.html property documentation])&lt;br /&gt;
&lt;br /&gt;
See the documentation of your linux distribution on how to configure a proper unicode locale.&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23237</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23237"/>
		<updated>2017-04-24T21:20:42Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:diagram_sources.zip]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=File:Diagram_sources.zip&amp;diff=23236</id>
		<title>File:Diagram sources.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=File:Diagram_sources.zip&amp;diff=23236"/>
		<updated>2017-04-24T21:20:10Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Main_Page_Advanced&amp;diff=23235</id>
		<title>AppSuite:Main Page Advanced</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:Main_Page_Advanced&amp;diff=23235"/>
		<updated>2017-04-24T21:06:02Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
= Overview =&lt;br /&gt;
*[[AppSuite:Architecture_Overview|Architecture Overview]]&lt;br /&gt;
*[[Appsuite:MiddlewareStartup|Middleware Startup]]&lt;br /&gt;
&lt;br /&gt;
= OX App Suite UI Development =&lt;br /&gt;
This page contains all the information you need to get started with UI development.&lt;br /&gt;
&lt;br /&gt;
This covers how-to articles including server communication, extension points and how to write widgets, applications and plugins:&lt;br /&gt;
&lt;br /&gt;
[[AppSuite:UI | Frontend development articles]]&lt;br /&gt;
&lt;br /&gt;
= Groupware Server customization =&lt;br /&gt;
* [[Automatic_Delete_OXObjects_Per_User|Automatically delete users OX-Objects and OX-Folders]]&lt;br /&gt;
* [[Login_variations|Background Information about Login Variation]]&lt;br /&gt;
* Auto login, session handling, single sign on&lt;br /&gt;
** [http://www.open-xchange.com/fileadmin/user_upload/open-xchange/document/presentation/OX-HE-Authentication-Sessionhandling-en-6.18.pdf Authentication and Sessionhandling white paper (EasyLogin)]&lt;br /&gt;
** [https://documentation.open-xchange.com/7.8.2/middleware/components/saml.html SAML SSO Integration]&lt;br /&gt;
** Custom login masks&lt;br /&gt;
*** [[Open-Xchange servlet for external login masks]]&lt;br /&gt;
&lt;br /&gt;
= Advanced Configuration =&lt;br /&gt;
* [[AppSuite:CalDAVClients | Configuration CalDAV with Open-Xchange]]&lt;br /&gt;
* [[AppSuite:CardDAVClients | Configuration CardDAV with Open-Xchange]]&lt;br /&gt;
* [[AppSuite:Caldav_carddav_Bundles| Installation CardDAV/CalDAV with Open-Xchange]]&lt;br /&gt;
* [[AppSuite:Running_a_cluster| Configuration Cluster-Setup]]&lt;br /&gt;
* [[AppSuite:Grizzly| Configuration Connector based on Grizzly]]&lt;br /&gt;
* [[ContactStorageLDAP| LDAP Contact Storage]]&lt;br /&gt;
* [[AppSuite:Sharing_and_Guest_Mode |Sharing and Guest Mode]]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/ui/features/metrics.html Metrics]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/ui/features/upsell.html Upsell]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/middleware/components/oauth_provider.html OAuth 2.0 - Provider/Operator Guide and Client Developer Guide]&lt;br /&gt;
* [[AppSuite:File_Storages_per_User |File Storage per User ]]&lt;br /&gt;
* [[AppSuite:Paste_inline_images |Pasting External Images into Mail Compose ]]&lt;br /&gt;
* [[AppSuite:Create_custom_folderview_entries_in_settings_app |Custom Folder View Entries in Settings ]]&lt;br /&gt;
* [[AppSuite:DB_user_privileges | Database User Privileges]]&lt;br /&gt;
* [[AppSuite:CrossContextDatabase |GlobalDB/Cross-Context Database ]]&lt;br /&gt;
* [[AppSuite:Filestorages |Setup external File Stores ]]&lt;br /&gt;
* [[AppSuite:Client_Onboarding|Configuration guide for Open-Xchange Client Onboarding]]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/middleware/components/auditlogging.html Audit logging]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/middleware/components/drivemail.html Drive Mail]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/middleware/components/mail_categories.html Mail Categories]&lt;br /&gt;
* [https://documentation.open-xchange.com/latest/middleware/components/virtual_mail_attachments.html Virtual Mail Attachments Connector]&lt;br /&gt;
* [https://documentation.open-xchange.com/7.8.3/middleware/components/trusted_connections.html Configure trusted TLS certificates]&lt;br /&gt;
* [https://documentation.open-xchange.com/7.8.3/middleware/components/websockets.html Configure Web Sockets]&lt;br /&gt;
* [[AppSuite:ResourceLimits | Configure Middleware Resource Limits]]&lt;br /&gt;
&lt;br /&gt;
= Programming Interfaces =&lt;br /&gt;
* The [https://documentation.open-xchange.com/latest/middleware/http_api.html HTTP API] is used by the Open-Xchange GUI and various 3rd party applications. It consists mainly of messages in JavaScript Object Notation ([http://json.org JSON]) sent over HTTP. Here is a general [https://documentation.open-xchange.com/latest/middleware/http_api/1_introduction.html Introduction to the HTTP API].&lt;br /&gt;
* Provisioning API to access the Open-Xchange Admin Daemon&lt;br /&gt;
** The [http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp RMI] API is used for data provisioning of Contexts, Users, Groups and Resources as well as for configuring Databases, Filestores and OX Servers: [http://software.open-xchange.com/products/appsuite/doc/RMI/javadoc/ OX RMI API]&lt;br /&gt;
** The [http://oxpedia.org/wiki/index.php?title=AppSuite:AdminGuide_7.8.2#OX_App_Suite_Management_.28CLT.29  CLT ] are shell scripts that simplify groupware and service administration&lt;br /&gt;
** Create contexts/users with with [[Csv_import]]&lt;br /&gt;
** [[Open-Xchange-SOAP|Provisioning using SOAP]]&lt;br /&gt;
* The [[Oxmapi|Oxmapi]] is a windows library for programmers needed to communicate with the OX server&lt;br /&gt;
* {{DocLink|docpath=mal/|name=Open-Xchange Mail Abstraction Layer}}&lt;br /&gt;
* [[UDPPush]] Open-Xchange PUSH Interface for Groupware Objects&lt;br /&gt;
&lt;br /&gt;
= Testing and QA =&lt;br /&gt;
* [[AppSuite:Web Tests|Web Tests]]&lt;br /&gt;
* [[AppSuite:Load Tests|Load Tests]]&lt;br /&gt;
* [[AppSuite:CLT Tests|CLT Tests]]&lt;br /&gt;
* [[AppSuite:SOAP Tests|SOAP Tests]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[AppSuite:Logincounter|logincounter]]&lt;br /&gt;
&lt;br /&gt;
= Translations =&lt;br /&gt;
* [[AppSuite:Available_Translations| Available Language Translations]]&lt;br /&gt;
* [[GUI Translation|Translate Open-Xchange to your community language]]&lt;br /&gt;
* [[AppSuite:Translate_Open-Xchange_to_supported_language|Translate Open-Xchange to supported language]]&lt;br /&gt;
&lt;br /&gt;
= Installation based on source code =&lt;br /&gt;
* [[SourceCodeAccess|Download the sourcecode]]&lt;br /&gt;
&lt;br /&gt;
= Integration =&lt;br /&gt;
* {{DocLink|docpath=whitepaper/OX-Directory-Integration-Whitepaper-English.pdf|name=Directory Integration Whitepaper}}&lt;br /&gt;
&lt;br /&gt;
= Additional =&lt;br /&gt;
* [[AppSuite:ISV_Mockups_Wireframes|Create Open-Xchange AppSuite Mockups / Wireframes]]&lt;br /&gt;
* [https://documentation.open-xchange.com/7.8.2/middleware/components/search/crossfolder_fts_in_mail.html Cross folder fulltext search with Dovecot]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:ResourceLimits&amp;diff=23234</id>
		<title>AppSuite:ResourceLimits</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:ResourceLimits&amp;diff=23234"/>
		<updated>2017-04-24T20:58:44Z</updated>

		<summary type="html">&lt;p&gt;Marens: Add redirect to middleware startup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[:Appsuite:MiddlewareStartup]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23233</id>
		<title>AppSuite:MiddlewareStartup</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=AppSuite:MiddlewareStartup&amp;diff=23233"/>
		<updated>2017-04-24T20:57:25Z</updated>

		<summary type="html">&lt;p&gt;Marens: Created page with &amp;quot; == Systemd ==  ==== Service definition ==== The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the serv...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=User:Marens&amp;diff=23232</id>
		<title>User:Marens</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=User:Marens&amp;diff=23232"/>
		<updated>2017-04-24T20:56:53Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Grizzly]]&lt;br /&gt;
&lt;br /&gt;
[[AppSuite:Open-Xchange_Installation_Guide_for_Debian_6.0/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[AppSuite:OX_Tutorial_10K/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[AppSuite:OX_Tutorial_100K/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[AppSuite:OX_Tutorial_1M/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[Template:OX_HE_Tutorial_Design]]&lt;br /&gt;
&lt;br /&gt;
[[Template:Oxinstaller/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[Appsuite:ResourceLimits/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[Appsuite:ResourceLimits]]&lt;br /&gt;
&lt;br /&gt;
[[Appsuite:ResourceLimits]]&lt;br /&gt;
&lt;br /&gt;
[[Sandbox:Middleware_Startup/sandbox]]&lt;br /&gt;
&lt;br /&gt;
[[Appsuite:MiddlewareStartup]]&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23231</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23231"/>
		<updated>2017-04-24T20:50:52Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Encoding detection during JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
From ''man 7 locale''&lt;br /&gt;
&lt;br /&gt;
  DESCRIPTION&lt;br /&gt;
       A  locale  is a set of language and cultural rules.  These cover aspects such as lan‐&lt;br /&gt;
       guage for messages, different character sets, lexicographic conventions, and  so  on.&lt;br /&gt;
       A program needs to be able to determine its locale and act accordingly to be portable&lt;br /&gt;
       to different cultures.&lt;br /&gt;
&lt;br /&gt;
The format to specify a system locale is: '''''language[_territory][.codeset][@modifier]'''''.&lt;br /&gt;
&lt;br /&gt;
Where all of&lt;br /&gt;
&lt;br /&gt;
* en_US.UTF-8&lt;br /&gt;
* en_US.utf8&lt;br /&gt;
* en_US.utf-8&lt;br /&gt;
* en_US.UTF_8 &lt;br /&gt;
&lt;br /&gt;
will result in a valid UTF-8 charmap for the english language with locale categories configured as&lt;br /&gt;
&lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
See for more infos: locale(1), locale(7), [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes], [https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes country codes] and [https://en.wikipedia.org/wiki/Character_encoding character encodings]&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
=== Verify that your system is configured with a proper unicode locale for OX ===&lt;br /&gt;
&lt;br /&gt;
Assuming you haven't reconfigured the locale of your root user&lt;br /&gt;
&lt;br /&gt;
  i|marens@karotte ~ $ su -&lt;br /&gt;
  Password: &lt;br /&gt;
  i|karotte ~ # locale charmap&lt;br /&gt;
  UTF-8&lt;br /&gt;
  i|karotte ~ #&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23230</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23230"/>
		<updated>2017-04-24T20:11:02Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Locale passing from client to server via SSH */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23229</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23229"/>
		<updated>2017-04-24T20:10:14Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23228</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23228"/>
		<updated>2017-04-24T20:06:45Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png|thumb|Querying the JVM via visualvm|right|300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [https://visualvm.github.io/ visualvm], query our [[Jolokia]] JMX bridge via http or just use the commandline like&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=File:Visualvm-file.encoding.png&amp;diff=23227</id>
		<title>File:Visualvm-file.encoding.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=File:Visualvm-file.encoding.png&amp;diff=23227"/>
		<updated>2017-04-24T20:01:55Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23226</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23226"/>
		<updated>2017-04-24T20:01:02Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Query which file encoding was detected by the JVM during startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
[[File:visualvm-file.encoding.png]]&lt;br /&gt;
&lt;br /&gt;
The file encoding that was detected by the JVM during startup can be queried via JMX. You can use graphical management tools like [[https://visualvm.github.io/|visualvm]], query our [[https://oxpedia.org/wiki/index.php?title=Jolokia|Jolokia]] JMX bridge via http or just &lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23225</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23225"/>
		<updated>2017-04-24T19:48:01Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Format &amp;gt;= 7.8.4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart'') all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23224</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23224"/>
		<updated>2017-04-24T19:47:06Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Format &amp;lt; 7.8.4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23223</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23223"/>
		<updated>2017-04-24T19:45:29Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Apply Resource limits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23222</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23222"/>
		<updated>2017-04-24T19:44:39Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Apply Resource limits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the diagrams above one of the differences is that:&lt;br /&gt;
&lt;br /&gt;
* systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram ''Service startup using systemd'') and limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd&lt;br /&gt;
* the older System V   style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram ''Service startup using upstart'').&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23221</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23221"/>
		<updated>2017-04-24T19:41:02Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;br /&gt;
&lt;br /&gt;
== Summary: Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23220</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23220"/>
		<updated>2017-04-24T19:38:31Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Warnings during early */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early start ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to '''/var/log/open-xchange/open-xchange-console.log'''.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23219</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23219"/>
		<updated>2017-04-24T19:20:08Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Encoding detection during JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
All of en_US.UTF-8, .utf8, .utf-8, .UTF_8 will result in a valid UTF-8 charmap&lt;br /&gt;
&lt;br /&gt;
==== JVM startup ====&lt;br /&gt;
&lt;br /&gt;
The default file.encoding detection is done at JVM startup based upon LC_CTYPE which makes sense as it's documented as:&lt;br /&gt;
&lt;br /&gt;
  CODESET (LC_CTYPE)&lt;br /&gt;
  Return  a  string  with the name of the character encoding used in the selected locale, such as &amp;quot;UTF-8&amp;quot;, &amp;quot;ISO-8859-1&amp;quot;,&lt;br /&gt;
  or &amp;quot;ANSI_X3.4-1968&amp;quot; (better known as US-ASCII).  This is the same string that you get with &amp;quot;locale charmap&amp;quot;.&lt;br /&gt;
  For a list of character encoding names, try &amp;quot;locale -m&amp;quot;, cf. locale(1).&lt;br /&gt;
&lt;br /&gt;
Furthermore this influences the defaultCharset selection of the JVM.&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the default charset of this Java virtual machine.&lt;br /&gt;
   *&lt;br /&gt;
   * The default charset is determined during virtual-machine startup and&lt;br /&gt;
   * typically depends upon the locale and charset of the underlying&lt;br /&gt;
   * operating system.&lt;br /&gt;
   *&lt;br /&gt;
   * @return  A charset object for the default charset&lt;br /&gt;
   *&lt;br /&gt;
   * @since 1.5&lt;br /&gt;
   */&lt;br /&gt;
  public static Charset defaultCharset() {&lt;br /&gt;
      if (defaultCharset == null) {&lt;br /&gt;
          synchronized (Charset.class) {&lt;br /&gt;
              String csn = AccessController.doPrivileged(&lt;br /&gt;
                  new GetPropertyAction(&amp;quot;file.encoding&amp;quot;));&lt;br /&gt;
              Charset cs = lookup(csn);&lt;br /&gt;
              if (cs != null)&lt;br /&gt;
                  defaultCharset = cs;&lt;br /&gt;
              else&lt;br /&gt;
                  defaultCharset = forName(&amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
      return defaultCharset;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Although we try to specify valid unicode encodings for every IO operations the Open-Xchange middleware does some parts of the JVM don't allow to specify the encoding to use and falls back to the detected default encoding. That's why admins have to make sure to provide a proper unicode environment for the middleware service during every start or use documented workarounds provided by Open-Xchange (e.g. )&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
  {key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to /var/log/open-xchange/open-xchange-console.log.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23218</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23218"/>
		<updated>2017-04-24T17:58:11Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Encoding detection during JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
=== Query which file encoding was detected by the JVM during startup ===&lt;br /&gt;
&lt;br /&gt;
  /opt/open-xchange/sbin/showruntimestats -r | sed -ne 's/.*\({key=file.encoding, value=[^}]*}\).*/\1/p'&lt;br /&gt;
{key=file.encoding, value=UTF-8}&lt;br /&gt;
&lt;br /&gt;
=== Locale passing from client to server via SSH ===&lt;br /&gt;
&lt;br /&gt;
The following setting of sshd allows clients to specify which locale to use on the server and might lead to some confusion or unexpected behaviour when checking the system locale or even to the usage of broken locales during middleware startup if your client sends misconfigured or missing locale configuration to the server.&lt;br /&gt;
&lt;br /&gt;
  grep AcceptEnv /etc/ssh/sshd_config &lt;br /&gt;
  AcceptEnv LANG LC_*&lt;br /&gt;
&lt;br /&gt;
For example when i connect to the machine my local german locale is sent to the server &lt;br /&gt;
&lt;br /&gt;
  [vagrant@showcase-community-centos-7 ~]$ locale -v &lt;br /&gt;
  LANG=de_DE.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=de_DE.UTF-8&lt;br /&gt;
  LC_TIME=de_DE.UTF-8&lt;br /&gt;
  LC_COLLATE=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=de_DE.UTF-8&lt;br /&gt;
  LC_MESSAGES=&amp;quot;de_DE.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=de_DE.UTF-8&lt;br /&gt;
  LC_NAME=de_DE.UTF-8&lt;br /&gt;
  LC_ADDRESS=de_DE.UTF-8&lt;br /&gt;
  LC_TELEPHONE=de_DE.UTF-8&lt;br /&gt;
  LC_MEASUREMENT=de_DE.UTF-8&lt;br /&gt;
  LC_IDENTIFICATION=de_DE.UTF-8&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
But after specifying that i want a new login shell the default locale configured for that user/system will be used instead!&lt;br /&gt;
&lt;br /&gt;
  [root@showcase-community-centos-7 vagrant]# su -s /bin/bash open-xchange -l&lt;br /&gt;
  -bash-4.2$ locale -v &lt;br /&gt;
  LANG=en_US.UTF-8&lt;br /&gt;
  LC_CTYPE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NUMERIC=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TIME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_COLLATE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MONETARY=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MESSAGES=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_PAPER=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_NAME=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ADDRESS=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_TELEPHONE=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_MEASUREMENT=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_IDENTIFICATION=&amp;quot;en_US.UTF-8&amp;quot;&lt;br /&gt;
  LC_ALL=&lt;br /&gt;
&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to /var/log/open-xchange/open-xchange-console.log.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23217</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23217"/>
		<updated>2017-04-24T17:38:01Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Evaluate JVM commandline options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
Before starting Java and the OSGi framework with all the Open-Xchange middleware bundles we have to evaluate several important JVM commandline options that influence the performance and stability of the Open-Xchange middleware stack. These commandline options are specified in '''/opt/open-xchange/etc/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
=== Format &amp;lt; 7.8.4 ===&lt;br /&gt;
For version up to 7.8.3 the JVM configuration options were all specified via a single property '''JAVA_XTRAOPTS''' which resulted in a rather long configuration string that was hard to read and maintain.&lt;br /&gt;
&lt;br /&gt;
  JAVA_XTRAOPTS=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 \&lt;br /&gt;
  -Dlogback.threadlocal.put.duplicate=false -server -Djava.awt.headless=true -Xmx512M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC \&lt;br /&gt;
  -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+UseTLAB \&lt;br /&gt;
  -Dosgi.compatibility.bootdelegation=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram Service startup using systemd and step 10 of diagram Service startup using upstart.) this JAVA_XTRAOPTS string goes through a basic validity check and is then passed to the JVM. &lt;br /&gt;
&lt;br /&gt;
=== Format &amp;gt;= 7.8.4 ===&lt;br /&gt;
Beginning from version 7.8.4 the options are split up and sorted into different categories like:&lt;br /&gt;
&lt;br /&gt;
  JAVA_OPTS_GC=&amp;quot;-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:NewRatio=3 -XX:+DisableExplicitGC&amp;quot;&lt;br /&gt;
  JAVA_OPTS_LOG=&amp;quot;-Dlogback.threadlocal.put.duplicate=false -XX:-OmitStackTraceInFastThrow&amp;quot;&lt;br /&gt;
  JAVA_OPTS_MEM=&amp;quot;-XX:MaxHeapSize=512M -XX:MaxPermSize=256M -XX:+UseTLAB&amp;quot;&lt;br /&gt;
  JAVA_OPTS_NET=&amp;quot;-Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10&amp;quot;&lt;br /&gt;
  JAVA_OPTS_OSGI=&amp;quot;-Dosgi.compatibility.bootdelegation=false&amp;quot;&lt;br /&gt;
  JAVA_OPTS_SERVER=&amp;quot;-server -Djava.awt.headless=true&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  JAVA_OPTS_OTHER=&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  #JAVA_OPTS_DEBUG=&amp;quot;-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mnt/heapdump -Xloggc:/var/log/open-xchange/gc.log -verbose:gc -XX:+PrintGCDateStamps \&lt;br /&gt;
  -XX:+PrintHeapAtGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution&amp;quot;&lt;br /&gt;
&lt;br /&gt;
which is much easier to read an maintain. Furthermore we added a useful '''JAVA_OPTS_DEBUG''' configuration parameter that comes preconfigured but unused/commented so that customers can quickly enable the most commonly used debugging options in case they have to provide detailed system information to Open-Xchange.&lt;br /&gt;
&lt;br /&gt;
During the startup of the open-xchange service (step 11 of diagram ''Service startup using systemd'' and step 10 of diagram ''Service startup using upstart''.) all uncommented JAVA_OPTS_* categories will then be evaluated and combined again into a single string of commandline options that can then be passed to the JVM.&lt;br /&gt;
&lt;br /&gt;
=== Upgrade procedure ===&lt;br /&gt;
During the upgrade '''7.8.3-revX -&amp;gt; 7.8.4-revY''' existing JAVA_XTRAOPTS will automatically be split up and migrated to the new categories approach. A backup of the file (ox-scriptconf.sh.timestamp) will be created and admins are urged to check for proper migration before deleting the backup file like it's already done with *.dpkg-dist or *.rpmnew files on Debian or RHEL/SLES distributions.&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to /var/log/open-xchange/open-xchange-console.log.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23216</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23216"/>
		<updated>2017-04-24T14:38:00Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysd.png|thumb|Service startup using systemd|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:mw_start_sysv.png|thumb|Service startup using upstart|left|1000px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to /var/log/open-xchange/open-xchange-console.log.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23215</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23215"/>
		<updated>2017-04-24T14:24:42Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysd.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
The default service definition as shipped by Open-Xchange can be found at /etc/init.d/open-xchange and will differ slightly depending on the distro in use.&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
As you can see in the two diagrams above one of the differences is that systemd reads all the infos wrt. resource limitations from the original service file and then applies possible further restrictions from the drop-in configs (steps 2 and 8 in the diagram). Limits configured in /opt/open-xchange/etc/ox-scriptconf.sh aren't considered anylonger when using systemd while the older System V style init has to source /opt/open-xchange/etc/ox-scriptconf.sh to be able to read the configs for the maximum number of processes (NPROC) and files(NRFILES) that the middleware shall be allowed to create/open (steps 3,4 and 15 in the diagram).&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
which you have already seen when we took a look at the [[#Service_definiton|service definition]] and [[#Drop-in_config|drop-in configs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;br /&gt;
&lt;br /&gt;
== Warnings during early ==&lt;br /&gt;
&lt;br /&gt;
Early warnings before the start of the JVM and related logging libraries like logback and logstash forwarding are redirected to /var/log/open-xchange/open-xchange-console.log.&lt;br /&gt;
&lt;br /&gt;
=== Limits ===&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
=== Locale ===&lt;br /&gt;
If the open-xchange startup script isn't able to detect a unicode locale you'll see a warning like the following (the current charmap might differ)&lt;br /&gt;
&lt;br /&gt;
  WARNING: Couldn't detect proper unicode charmap in locale category LC_CTYPE.&lt;br /&gt;
  WARNING: Current charmap: &amp;quot;ANSI_X3.4-1968&amp;quot; might cause encoding problems.&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23214</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23214"/>
		<updated>2017-04-24T13:49:54Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysd.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
The default service definition as shipped by Open-Xchange is rather concise and easy to read. You can check by looking at the service file that is installed to either /usr/lib/systemd or /lib/systemd depending on your distribution of choice.&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
==== Drop-in configs ====&lt;br /&gt;
Drop in configs allow administrators to easily adapt and override default service unit files. So if you want to change the default limits or add additional limits have a look at our default example drop-in config which is located at /etc/systemd/system/open-xchange.service.d/limits.conf&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
The systemd.exec documentation shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
==== Service definition ====&lt;br /&gt;
&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
=== Background Infos ===&lt;br /&gt;
&lt;br /&gt;
Several ways exist to restrict resources on a linux system from a global level down to user/groups or even shells and the processes started by them.&lt;br /&gt;
&lt;br /&gt;
==== Sysctl ====&lt;br /&gt;
Sysctl is used to modify kernel parameters at runtime. E.g. to set the maximum number of files&lt;br /&gt;
&lt;br /&gt;
  $ sysctl -w fs.file-max=100000&lt;br /&gt;
&lt;br /&gt;
To permanently set them append to the main configuration file and reload the settings&lt;br /&gt;
&lt;br /&gt;
  $ echo fs.file-max=100000 &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
  $ sysctl -p&lt;br /&gt;
&lt;br /&gt;
More infos can be found via '''man sysctl'''&lt;br /&gt;
&lt;br /&gt;
==== Limits.conf ====&lt;br /&gt;
&lt;br /&gt;
Allows to restrict resources an a global, group or user level. E.g:&lt;br /&gt;
&lt;br /&gt;
   $ cat /etc/security/limits.d/90-nproc.conf &lt;br /&gt;
   # Default limit for number of user's processes to prevent&lt;br /&gt;
   # accidental fork bombs.&lt;br /&gt;
   # See rhbz #432903 for reasoning.&lt;br /&gt;
   &lt;br /&gt;
   *          soft    nproc     1024&lt;br /&gt;
&lt;br /&gt;
From '''man limits.conf''':&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
''Also, please note that all limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of the session.''&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The limits per login are applied via the ''pam'' stack. See '''man pam''' and '''man pam_limits''' for more details. As those limits are bound to sessions they don't affect most daemons started by our supported init systems or init utils. Most state that they are ignored by design, see [https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/938669/comments/4 upstart], [https://bugzilla.redhat.com/show_bug.cgi?id=754285#c1 systemd] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=302079 start-stop-daemon] &lt;br /&gt;
&lt;br /&gt;
===== Ulimit =====&lt;br /&gt;
From '''man bash'''&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
ulimit [-HSTabcdefilmnpqrstuvx [limit]]&lt;br /&gt;
              Provides  control over the resources available to the shell and to processes started by it, on systems that allow such control.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This is what we use in our System V compatible init scripts to increase resources for the open-xchange process across multiple distros. Currently only ''the maximum number of processes'' and ''the maximum number of open file descriptors available to a single user'' are increased via ulimit. The values are specified in '''/opt/open-xchange/ox-scriptconf.sh'''&lt;br /&gt;
&lt;br /&gt;
==== Systemd ====&lt;br /&gt;
&lt;br /&gt;
===== Control Groups=====&lt;br /&gt;
&lt;br /&gt;
Control groups should only affect the OX middleware if you create/manage them yourself of if you are using a ''modern'' distribution that already uses systemd as init.&lt;br /&gt;
&lt;br /&gt;
Citing from the kernel cgroup [https://www.kernel.org/doc/Documentation/cgroup-v2.txt documentation]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
1-2. What is cgroup?&lt;br /&gt;
&lt;br /&gt;
cgroup is a mechanism to organize processes hierarchically and&lt;br /&gt;
distribute system resources along the hierarchy in a controlled and&lt;br /&gt;
configurable manner.&lt;br /&gt;
&lt;br /&gt;
cgroup is largely composed of two parts - the core and controllers.&lt;br /&gt;
cgroup core is primarily responsible for hierarchically organizing&lt;br /&gt;
processes.  A cgroup controller is usually responsible for&lt;br /&gt;
distributing a specific type of system resource along the hierarchy&lt;br /&gt;
although there are utility controllers which serve purposes other than&lt;br /&gt;
resource distribution.&lt;br /&gt;
&lt;br /&gt;
cgroups form a tree structure and every process in the system belongs&lt;br /&gt;
to one and only one cgroup.  All threads of a process belong to the&lt;br /&gt;
same cgroup.  On creation, all processes are put in the cgroup that&lt;br /&gt;
the parent process belongs to at the time.  A process can be migrated&lt;br /&gt;
to another cgroup.  Migration of a process doesn't affect already&lt;br /&gt;
existing descendant processes.&lt;br /&gt;
&lt;br /&gt;
Following certain structural constraints, controllers may be enabled or&lt;br /&gt;
disabled selectively on a cgroup.  All controller behaviors are&lt;br /&gt;
hierarchical - if a controller is enabled on a cgroup, it affects all&lt;br /&gt;
processes which belong to the cgroups consisting the inclusive&lt;br /&gt;
sub-hierarchy of the cgroup.  When a controller is enabled on a nested&lt;br /&gt;
cgroup, it always restricts the resource distribution further.  The&lt;br /&gt;
restrictions set closer to the root in the hierarchy can not be&lt;br /&gt;
overridden from further away.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So processes are organized into a tree structure of control groups and controllers are responsible for the distribution of resources. So what kind of controllers exist?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
5. Controllers&lt;br /&gt;
&lt;br /&gt;
5-1. CPU&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cpu&amp;quot; controllers regulates distribution of CPU cycles.  This&lt;br /&gt;
controller implements weight and absolute bandwidth limit models for&lt;br /&gt;
normal scheduling policy and absolute bandwidth allocation model for&lt;br /&gt;
realtime scheduling policy.&lt;br /&gt;
&lt;br /&gt;
5-2. Memory&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;memory&amp;quot; controller regulates distribution of memory.&lt;br /&gt;
...&lt;br /&gt;
While not completely water-tight, all major memory usages by a given&lt;br /&gt;
cgroup are tracked so that the total memory consumption can be&lt;br /&gt;
accounted and controlled to a reasonable extent.&lt;br /&gt;
&lt;br /&gt;
5-3. IO&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;io&amp;quot; controller regulates the distribution of IO resources.  This&lt;br /&gt;
controller implements both weight based and absolute bandwidth or IOPS&lt;br /&gt;
limit distribution; however, weight based distribution is available&lt;br /&gt;
only if cfq-iosched is in use and neither scheme is available for&lt;br /&gt;
blk-mq devices.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The open-xchange service is simply put into the default ''system.slice'' without applying further limits.&lt;br /&gt;
&lt;br /&gt;
  singlenode$ systemd-cgls&lt;br /&gt;
  ├─1 /sbin/init&lt;br /&gt;
  ├─system.slice&lt;br /&gt;
  │ ├─avahi-daemon.service&lt;br /&gt;
  │ │ ├─501 avahi-daemon: running [singlenode]&lt;br /&gt;
  │ │ └─514 avahi-daemon: chroot helper&lt;br /&gt;
  │ ├─console-kit-daemon.service&lt;br /&gt;
  │ │ └─16164 /usr/sbin/console-kit-daemon --no-daemon&lt;br /&gt;
  │ ├─dbus.service&lt;br /&gt;
  │ │ └─508 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation&lt;br /&gt;
  │ ├─munin-node.service&lt;br /&gt;
  │ │ └─4290 /usr/bin/perl -wT /usr/sbin/munin-node&lt;br /&gt;
  │ ├─open-xchange.service&lt;br /&gt;
  │ │ └─6037 /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600 -Dnetworkaddress.cache.negative.ttl=10 ...&lt;br /&gt;
&lt;br /&gt;
To check all the details use&lt;br /&gt;
&lt;br /&gt;
 singlenode:~ # systemctl show system.slice&lt;br /&gt;
&lt;br /&gt;
==== Limits besides control groups ====&lt;br /&gt;
Besides control groups systemd allows you to apply other limits to the execution environment of your service. Here we can apply the limits that would normally be applied via ''limits.conf'' or ''ulimit''. Systemd uses [http://man7.org/linux/man-pages/man2/setrlimit.2.html setrlimit] for this. The options that we set by default are:&lt;br /&gt;
&lt;br /&gt;
  * LimitNOFILE&lt;br /&gt;
  * LimitNPROC&lt;br /&gt;
&lt;br /&gt;
You can check this by looking at the service file that is shipped by default ('''Note:''' Depending on your distro the service files may be located either in /usr/lib/systemd or /lib/systemd. We'll use /usr/lib in this oxpedia article)&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /usr/lib/systemd/system/open-xchange.service &lt;br /&gt;
  [Unit]&lt;br /&gt;
  After=remote-fs.target&lt;br /&gt;
  After=time-sync.target ypbind.service sendmail.service cyrus.service  &lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  User=open-xchange&lt;br /&gt;
  PermissionsStartOnly=true&lt;br /&gt;
  TimeoutStartSec=0&lt;br /&gt;
  ExecStartPre=/opt/open-xchange/sbin/triggerupdatethemes -u&lt;br /&gt;
  ExecStart=/opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  ExecStop=/opt/open-xchange/sbin/shutdown -w&lt;br /&gt;
  ExecReload=/opt/open-xchange/sbin/triggerreloadconfiguration -d&lt;br /&gt;
  KillMode=process&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
===== Drop-in configs =====&lt;br /&gt;
Drop in configs allow administrators to easily override the default service unit files. So if you want to change the default limits or add additional limits have a look at&lt;br /&gt;
&lt;br /&gt;
  singlenode:~ # cat /etc/systemd/system/open-xchange.service.d/limits.conf &lt;br /&gt;
  # Override and add options in this file&lt;br /&gt;
  # See systemd.exec(5) for other limits&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  #LimitNPROC=65536&lt;br /&gt;
  #LimitNOFILE=65536&lt;br /&gt;
&lt;br /&gt;
== Verify limits ==&lt;br /&gt;
&lt;br /&gt;
=== System V ===&lt;br /&gt;
&lt;br /&gt;
Get the proper pid of the java process started for the middleware by either checking '''ps faux'''&lt;br /&gt;
  root      4103  0.0  0.0  66528  1868 pts/0    S    22:05   0:00 su -s /bin/bash open-xchange -c /opt/open-xchange/sbin/open-xchange&lt;br /&gt;
  494       4109  9.5 19.8 2224644 381312 ?      Ssl  22:05   1:12  \_ /usr/bin/java -Dsun.net.inetaddr.ttl=3600 -Dnetworkaddress.cache.ttl=3600&lt;br /&gt;
&lt;br /&gt;
or programmatically&lt;br /&gt;
  singlenode:~ # pid=$(pgrep -P $(&amp;lt;/var/run/open-xchange.pid) java)&lt;br /&gt;
&lt;br /&gt;
and check the limits applied for that process&lt;br /&gt;
  singlenode:~ # cat /proc/$pid/limits&lt;br /&gt;
  Limit                     Soft Limit           Hard Limit           Units&lt;br /&gt;
  Max cpu time              unlimited            unlimited            seconds&lt;br /&gt;
  Max file size             unlimited            unlimited            bytes&lt;br /&gt;
  Max data size             unlimited            unlimited            bytes&lt;br /&gt;
  Max stack size            8388608              unlimited            bytes&lt;br /&gt;
  Max core file size        0                    unlimited            bytes&lt;br /&gt;
  Max resident set          unlimited            unlimited            bytes&lt;br /&gt;
  Max processes             65536                65536                processes&lt;br /&gt;
  Max open files            65536                65536                files&lt;br /&gt;
  Max locked memory         65536                65536                bytes&lt;br /&gt;
  Max address space         unlimited            unlimited            bytes&lt;br /&gt;
  Max file locks            unlimited            unlimited            locks&lt;br /&gt;
  Max pending signals       24254                24254                signals&lt;br /&gt;
  Max msgqueue size         819200               819200               bytes&lt;br /&gt;
  Max nice priority         0                    0&lt;br /&gt;
  Max realtime priority     0                    0&lt;br /&gt;
  Max realtime timeout      unlimited            unlimited            us&lt;br /&gt;
&lt;br /&gt;
=== Systemd ===&lt;br /&gt;
  singlenode:~ # systemctl show open-xchange | grep Limit&lt;br /&gt;
  StartLimitInterval=10000000&lt;br /&gt;
  StartLimitBurst=5&lt;br /&gt;
  StartLimitAction=none&lt;br /&gt;
  MemoryLimit=18446744073709551615&lt;br /&gt;
  LimitCPU=18446744073709551615&lt;br /&gt;
  LimitFSIZE=18446744073709551615&lt;br /&gt;
  LimitDATA=18446744073709551615&lt;br /&gt;
  LimitSTACK=18446744073709551615&lt;br /&gt;
  LimitCORE=18446744073709551615&lt;br /&gt;
  LimitRSS=18446744073709551615&lt;br /&gt;
  LimitNOFILE=65536&lt;br /&gt;
  LimitAS=18446744073709551615&lt;br /&gt;
  LimitNPROC=65536&lt;br /&gt;
  LimitMEMLOCK=65536&lt;br /&gt;
  LimitLOCKS=18446744073709551615&lt;br /&gt;
  LimitSIGPENDING=19827&lt;br /&gt;
  LimitMSGQUEUE=819200&lt;br /&gt;
  LimitNICE=0&lt;br /&gt;
  LimitRTPRIO=0&lt;br /&gt;
  LimitRTTIME=18446744073709551615&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Open-Xchange middleware on specific distros ==&lt;br /&gt;
The support for the mentioned mechanism of resource control differ depending on the distribution and the init system in use.&lt;br /&gt;
&lt;br /&gt;
=== Debian 7 ===&lt;br /&gt;
;Init&lt;br /&gt;
: System V style&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. The open-xchange service is finally started via start-stop-daemon which doesn't doesn't consider '''/etc/security/limits.*'''&lt;br /&gt;
&lt;br /&gt;
=== RHEL 6 / CentOS 6 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Upstart, System V compatible&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
The mentioned limits can be configured via '''/opt/open-xchange/etc/ox-scriptconf.sh'''. The limits are applied via ulimit in the service's init script. Furthermore as the open-xchange service is finally started via '''su ... open-xchange''' on this distro a user session is opened via su/pam and the default CentOS pam config reads the '''/etc/security/limits.*''' configuration by loading the pam stack like:&lt;br /&gt;
&lt;br /&gt;
: '''/etc/pam.d/su'''&lt;br /&gt;
:: '''-&amp;gt; /etc/pam.d/system-auth'''&lt;br /&gt;
::: '''-&amp;gt; pam_limits.so'''&lt;br /&gt;
&lt;br /&gt;
If NPROC isn't configured for the open-xchange-server it's restricted to '''1024''' globally by default to prevent accidental fork bombs, see '''/etc/security/limits.d/90-nproc.conf''' which can result in severe problems modern multithreaded applications.&lt;br /&gt;
&lt;br /&gt;
=== RHEL 7 / CentOS 7 / Debian 8 / SLE 12 ===&lt;br /&gt;
;Init&lt;br /&gt;
: Systemd&lt;br /&gt;
;OX Configurable Limits/Defaults&lt;br /&gt;
: nofile, nproc&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at '''/usr/lib/systemd/system/open-xchange.service'''. The drop-in config to override or extend the default unit file is located at '''/etc/systemd/system/open-xchange.service.d/limits.conf'''. [https://www.freedesktop.org/software/systemd/man/systemd.exec.html Systemd.exec] shows a whole lot of options that can be used by admins to adapt the default service to their specific needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Warnings ==&lt;br /&gt;
If the open-xchange startup script isn't able to set the proper limits on CentOS 6 due to e.g. hard limits being enforced via pam_limits you'll see the following warning in the console log during startup&lt;br /&gt;
&lt;br /&gt;
  singlenode open-xchange # cat open-xchange-console.log&lt;br /&gt;
  /opt/open-xchange/sbin/open-xchange: line 115: ulimit: max user processes: cannot modify limit: Operation not permitted&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23213</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23213"/>
		<updated>2017-04-24T13:23:14Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysd.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
=== Systemd details explained ===&lt;br /&gt;
&lt;br /&gt;
For systemd the default limits are configured directly in the service's unit file that is shipped by OX and located at /usr/lib/systemd/system/open-xchange.service. The drop-in config to override or extend the default unit file is located at /etc/systemd/system/open-xchange.service.d/limits.conf. Systemd.exec shows a whole lot of options that can be used by admins to adapt the default service to their specific needs. &lt;br /&gt;
&lt;br /&gt;
==== 2 Drop-in Configs ====&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart details explained ==&lt;br /&gt;
&lt;br /&gt;
=== Recheck resource limits ===&lt;br /&gt;
&lt;br /&gt;
Explain why it's needed and linkg to resource limits&lt;br /&gt;
&lt;br /&gt;
== Apply Resource limits ==&lt;br /&gt;
&lt;br /&gt;
{{AppSuite:ResourceLimits}}&lt;br /&gt;
&lt;br /&gt;
== Evaluate JVM commandline options ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encoding detection during JVM startup ==&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=File:Mw_start_sysd.png&amp;diff=23212</id>
		<title>File:Mw start sysd.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=File:Mw_start_sysd.png&amp;diff=23212"/>
		<updated>2017-04-24T13:07:21Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23211</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23211"/>
		<updated>2017-04-24T13:07:08Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Systemd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Middleware start =&lt;br /&gt;
&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysd.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Details explained ==&lt;br /&gt;
&lt;br /&gt;
=== Evaluate JVM commandline options ===&lt;br /&gt;
&lt;br /&gt;
=== Apply Resource limits ===&lt;br /&gt;
&lt;br /&gt;
{{AppSuite:ResourceLimits}}&lt;br /&gt;
&lt;br /&gt;
=== Encoding detection during JVM startup ===&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=File:Mw_start_sysv.png&amp;diff=23210</id>
		<title>File:Mw start sysv.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=File:Mw_start_sysv.png&amp;diff=23210"/>
		<updated>2017-04-24T13:06:39Z</updated>

		<summary type="html">&lt;p&gt;Marens: Marens uploaded a new version of &amp;amp;quot;File:Mw start sysv.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;middleware start with system v / upstart&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23209</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23209"/>
		<updated>2017-04-21T12:15:03Z</updated>

		<summary type="html">&lt;p&gt;Marens: /* Encoding detection during JVM startup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Middleware start =&lt;br /&gt;
&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Details explained ==&lt;br /&gt;
&lt;br /&gt;
=== Evaluate JVM commandline options ===&lt;br /&gt;
&lt;br /&gt;
=== Apply Resource limits ===&lt;br /&gt;
&lt;br /&gt;
{{AppSuite:ResourceLimits}}&lt;br /&gt;
&lt;br /&gt;
=== Encoding detection during JVM startup ===&lt;br /&gt;
Add details from https://bugs.open-xchange.com/show_bug.cgi?id=51074&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
	<entry>
		<id>https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23208</id>
		<title>Sandbox:Middleware Startup/sandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.open-xchange.com/wiki/index.php?title=Sandbox:Middleware_Startup/sandbox&amp;diff=23208"/>
		<updated>2017-04-20T23:07:31Z</updated>

		<summary type="html">&lt;p&gt;Marens: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Middleware start =&lt;br /&gt;
&lt;br /&gt;
== Systemd ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== System V / Upstart ==&lt;br /&gt;
&lt;br /&gt;
[[File:mw_start_sysv.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Details explained ==&lt;br /&gt;
&lt;br /&gt;
=== Evaluate JVM commandline options ===&lt;br /&gt;
&lt;br /&gt;
=== Apply Resource limits ===&lt;br /&gt;
&lt;br /&gt;
{{AppSuite:ResourceLimits}}&lt;br /&gt;
&lt;br /&gt;
=== Encoding detection during JVM startup ===&lt;/div&gt;</summary>
		<author><name>Marens</name></author>
	</entry>
</feed>