<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tetiana Fydorenchyk</title>
    <description>The latest articles on DEV Community by Tetiana Fydorenchyk (@tetiana_ftv).</description>
    <link>https://dev.to/tetiana_ftv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F64628%2F178a80b7-333e-4b15-87c5-8bfb8ca11356.jpg</url>
      <title>DEV Community: Tetiana Fydorenchyk</title>
      <link>https://dev.to/tetiana_ftv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tetiana_ftv"/>
    <language>en</language>
    <item>
      <title>Java Garbage Collection Types and Settings</title>
      <dc:creator>Tetiana Fydorenchyk</dc:creator>
      <pubDate>Wed, 21 Aug 2019 18:46:31 +0000</pubDate>
      <link>https://dev.to/tetiana_ftv/java-garbage-collection-types-and-settings-3opj</link>
      <guid>https://dev.to/tetiana_ftv/java-garbage-collection-types-and-settings-3opj</guid>
      <description>&lt;p&gt;Performance and price are two big considerations in application hosting that always matter. And, often, we question ourselves on how to decrease the spends, without affecting the performance of your apps at the same time. In this article, we’d like to address automatic memory management for Java applications hosted with Jelastic using garbage collection.&lt;/p&gt;

&lt;p&gt;Let’s clarify what garbage collection is, what it does for Java applications and how it works within Jelastic PaaS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java Garbage Collection Overview
&lt;/h2&gt;

&lt;p&gt;Garbage Collection is a form of automatic memory management. Its aim is to find data objects in memory that are no longer demanded and make their space available for reuse.&lt;/p&gt;

&lt;p&gt;The created object uses some memory that remains allocated until there are references for the use of the object. When there are no references for an object, it is considered to be no longer required and the memory occupied by the object can be reclaimed. In such a way, you don’t pay for unused resources and can cut your costs.&lt;/p&gt;

&lt;p&gt;We’ve &lt;a href="https://jelastic.com/blog/tuning-garbage-collector-java-memory-usage-optimization/" rel="noopener noreferrer"&gt;tested different kinds of Garbage Collectors (GC)&lt;/a&gt; and defined the most appropriate ones for the Java applications hosted in our cloud, taking into consideration the automatic vertical scaling that Jelastic provides. As a result of our investigations, we adjusted the default settings of Garbage Collectors in Jelastic in order to increase the benefits for our users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collector-types.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collector-types.png" alt="java-garbage-collector-types"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jelastic supports the following GCs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G1 GC (-XX:+UseG1GC)&lt;/strong&gt; is a default GC in Jelastic PaaS. The Garbage-First (G1) is a server-style Garbage Collector for multiprocessor machines with a large amount of memory. The heap is partitioned into fixed-sized regions and G1 tracks the live data in those regions. When Garbage Collection is required, it collects from the regions with less live data first.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shenandoah GC (-XX:+UseShenandoahGC)&lt;/strong&gt; is a concurrent garbage collector for the JVM. Concurrent means that the GC tries to perform most of the activities in parallel without interrupting application performance. Such parallelism makes “stop-the-world” (STW) pauses extremely short that is the most required task for each GC. Another inherent advantage is an efficient work with small and large heaps with no impact on STW pauses’ length. Note that for using this GC, you need to unlock experimental options with -XX:+UnlockExperimentalVMOptions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ZGC (-XX:+UseZGC)&lt;/strong&gt; is low latency scalable garbage collector. Designed for use with applications that require a large heap and low latency. It uses a bunch of one generation and performs most (but not all) garbage collection in parallel with uninterrupted application work. This greatly limits the impact of garbage collection on your application response time. Note that before calling this GC type, you need to unlock experimental options with -XX:+UnlockExperimentalVMOptions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Epsilon GC (-XX:+UseEpsilonGC)&lt;/strong&gt; is a passive GC that handles memory allocation and doesn’t clear it when objects are no longer used. When your application exhausts the Java heap, the JVM goes down. So, EpsilonGC prolongs an application life until the memory will run out and dumps the memory, that can be useful for application memory usage debugging, as well as measuring and managing application performance. Note that before calling this GC type, you need to unlock experimental options with -XX:+UnlockExperimentalVMOptions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parallel&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;ParNew GC (-XX:+UseParNewGC)&lt;/strong&gt; is a “stop-the-world” multithreaded Garbage Collector. Mostly it is aimed to collect the young generation objects. Since the young generation is normally small in size, the ParNew does collection very fast and does not impact your application too much. In addition, ParNew has compaction of unused RAM that enables support of automatic vertical scaling – one of the prominent Jelastic features.&lt;br&gt;
&lt;strong&gt;Parallel GC (-XX:+UseParallelGC)&lt;/strong&gt; is used when the parallel collection method  is required over young generation only. It cannot be applied along with ConcMarkSweep GC simultaneously unlike ParNew GC.&lt;br&gt;
&lt;strong&gt;Parallel Old GC (-XX:+UseParallelOldGC)&lt;/strong&gt; utilizes a parallel “mark and compact” algorithm which catches all application threads and then handles labeling and subsequent compaction with multiple garbage collector threads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ConcMarkSweep GC (-XX:+UseConcMarkSweepGC)&lt;/strong&gt; collector is designed for applications that prefer shorter garbage collection pauses and which can afford to share processor resources with the garbage collector while the application is running. It makes sense to use such a collector when applications requirements for time garbage collection pauses are low.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serial GC (-XX:+UseSerialGC)&lt;/strong&gt; performs garbage collection in a single thread and has the lowest consumption of memory among all GC types but, at the same time, it makes long pauses that can lead to application performance degradation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Default JVM Options in Jelastic PaaS
&lt;/h2&gt;

&lt;p&gt;By default Jelastic PaaS uses G1 GC for JVM 8+ versions. For lower versions it employs the ParNew GC. Also, for JVM versions below 12 Jelastic attaches &lt;a href="https://github.com/jelastic-jps/java-memory-agent" rel="noopener noreferrer"&gt;jelastic-gc-agent.jar&lt;/a&gt; which enables vertical scaling for older releases.&lt;/p&gt;

&lt;p&gt;For JVM 12+ versions, the platform provides &lt;a href="https://jelastic.com/blog/elastic-jvm-vertical-scaling/" rel="noopener noreferrer"&gt;integrated vertical scaling&lt;/a&gt; to ensure G1 triggering with the following pre-set container &lt;a href="https://docs.jelastic.com/container-variables" rel="noopener noreferrer"&gt;variables&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;G1PERIODIC_GC_INTERVAL=3000&lt;/strong&gt; 
Interval between garbage collection in milliseconds (15 minutes by default)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GC_SYS_LOAD_THRESHOLD_RATE=0.3&lt;/strong&gt;
Custom multiplier to flexibly adjust the G1PeriodicGCSystemLoadThreshold value&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;G1PERIODIC_GC_SYS_LOAD_THRESHOLD={CPU_cores_number}*GC_SYS_LOAD_THRESHOLD_RATE&lt;/strong&gt;
Activates garbage collection, if the average one-minute system load is below the set value. This condition is ignored if set as zero.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-variables-for-scaling.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-variables-for-scaling.png" alt="java garbage collection variables for scaling"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can always check current settings of your Java process by executing &lt;strong&gt;ps -ax | grep java&lt;/strong&gt;. You will see something like this:  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;/usr/java/libericajdk-12.0.1/bin/java.orig -server -XX:G1PeriodicGCSystemLoadThreshold=0.6 -XX:G1PeriodicGCInterval=900k -XX:+UseStringDeduplication –&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;XX:+UseG1GC -Xmaxf0.3 -Xminf0.1 -Xmx1638M -Xmn30M -Xms32M -jar jelastic-helloworld-1.1.war&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also Jelastic automatically configures the following parameters:&lt;/p&gt;

&lt;p&gt;Xmx – 80% of total available RAM in the container &lt;br&gt;
Xms – 32MB &lt;br&gt;
Xmn – 30MB&lt;/p&gt;

&lt;p&gt;If JVM version is higher than 12, the platform additionally configures the following Java options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;G1PeriodicGCSystemLoadThreshold=CPU_COUNT*0.3&lt;/strong&gt;
30% of load average based on number of CPU cores available in the container
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;G1PeriodicGCInterval=900k&lt;/strong&gt;
15 minutes should pass since any previous garbage collection pause 
For more details, you can review the following script that &lt;a href="https://github.com/jelastic-jps/java-memory-agent/blob/master/scripts/memoryConfig.sh" rel="noopener noreferrer"&gt;manages automatic configuration of the Java options&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Customization of GC Settings in Jelastic PaaS
&lt;/h2&gt;

&lt;p&gt;If you believe that customization of default settings can improve performance or memory consumption, you can tune them according to the requirements of your application. We recommend customizing these configurations only if you fully understand the impact of such changes on your application behaviour.&lt;/p&gt;

&lt;p&gt;You can set a custom GC parameter based on your application requirements via &lt;a href="https://docs.jelastic.com/environment-variables" rel="noopener noreferrer"&gt;Environment Variables&lt;/a&gt; (please do not mix them with Java options).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-variables.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-variables.png" alt="java garbage collection variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;_JAVA_OPTIONS and JAVA_TOOL_OPTIONS&lt;/strong&gt; – please &lt;a href="https://stackoverflow.com/questions/28327620/difference-between-java-options-java-tool-options-and-java-opts" rel="noopener noreferrer"&gt;read more about these options&lt;/a&gt;.
Java options can be used for changing default GC type, for example:
_JAVA_OPTIONS=”-XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GC_DEF&lt;/strong&gt; – type of Garbage Collector, for example GC_DEF=G1GC &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMX_DEF_PERCENT&lt;/strong&gt; – RAM percentage to be provided as XMX, for example XMX_DEF_PERCENT=80&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMX_DEF&lt;/strong&gt; (or just XMX) – maximum size for the Java heap memory, for example if total RAM is 2048Mb the XMX_DEF=1638&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMS_DEF&lt;/strong&gt; (or just XMS) – initial java heap size, for example XMS=32M&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMN_DEF&lt;/strong&gt; – the size of the heap for the young generation, for example XMN=30M&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;G1PERIODIC_GC_INTERVAL&lt;/strong&gt; (for openJDK 12/13 only) – a frequency of the G1 Periodic Collection in milliseconds (G1PeriodicGCInterval – 15 minutes by default); set as 0 to disable, G1PERIODIC_GC_INTERVAL=900&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;G1PERIODIC_GC_SYS_LOAD_THRESHOLD&lt;/strong&gt; (for openJDK 12/13 only) – allows G1 Periodic Collection execution, if the average one-minute system load is below the set value; This condition is ignored if set as zero. By default, it is equal to the {CPU_cores_number}*{GC_SYS_LOAD_THRESHOLD_RATE}&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GC_SYS_LOAD_THRESHOLD_RATE&lt;/strong&gt; (for openJDK 12/13 only) – custom multiplier to flexibly adjust the G1PeriodicGCSystemLoadThreshold value (0.3 by default), for example G1PERIODIC_GC_SYS_LOAD_THRESHOLD_RATE=0.3&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FULL_GC_AGENT_DEBUG&lt;/strong&gt; – enables (true) or disables (false) the debug mode to track the Java GC processes in the logs, for example, FULL_GC_AGENT_DEBUG=true&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FULL_GC_PERIOD&lt;/strong&gt; – Sets the interval (in seconds) between the full GC calls; 900 by default, i.e. 15 minutes, for example FULL_GC_PERIOD=900&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MAXPERMSIZE&lt;/strong&gt;– automatically defined only for those Java containers, which run JVM version lower than 8th and with an allocated amount of RAM &amp;gt; 800 MiB. In all other cases (i.e. if container scaling limit is less than 7 &lt;a href="https://docs.jelastic.com/cloudlet" rel="noopener noreferrer"&gt;cloudlets&lt;/a&gt; or it uses Java 8) this parameter is omitted. The actual value of the MaxPermSize setting is calculated based on Xmx memory amount divided by ten, but cannot be set greater than maximum of 256 MiB. For example, MAXPERMSIZE=163&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMINF_DEF&lt;/strong&gt;– this parameter controls the minimum free space in the heap and instructs the JVM to expand the heap, if after performing garbage collection it does not have at least XMINF_DEF value of free space. For example, XMINF_DEF=0.1&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XMAXF_DEF&lt;/strong&gt; – this parameter controls how the heap is expanded and instructs the JVM to compact the heap if the amount of free space exceeds XMAXF_DEF value.  For example, XMAXF_DEF=0.3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alternatively, all these parameters can be passed to Java process via &lt;strong&gt;variables.conf&lt;/strong&gt; in the container.&lt;/p&gt;

&lt;p&gt;All of the paths to config, executable or log files can differ based on the Java server you use and can be accessed via &lt;a href="https://docs.jelastic.com/configuration-file-manager" rel="noopener noreferrer"&gt;Configuration File Manager&lt;/a&gt; or &lt;a href="https://docs.jelastic.com/ssh-access" rel="noopener noreferrer"&gt;SSH&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Conf&lt;/strong&gt; files to configure your Java server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-configurations.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-configurations.png" alt="java garbage collection configurations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For Tomcat, navigate to the &lt;strong&gt;opt &amp;gt; tomcat &amp;gt; conf &amp;gt; variables.conf&lt;/strong&gt; file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-configurations2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-configurations2.png" alt="java garbage collection configurations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the opened variables.conf file you can override garbage collector default settings or even add another GC to replace the default one (G1). So if you want to use ShenandoahGC instead, simply add it to the variables.conf as stated in the example below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     -XX:+UnlockExperimentalVMOptions

     -XX:+UseShenandoahGC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-change-GC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-change-GC.png" alt="java garbage collection change GC"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After this, only the specified garbage collector will be used while starting your Java server without taking into consideration the amount of allocated resources.&lt;/p&gt;

&lt;p&gt;Also, you can control how JVM handles its heap memory with other JAVA options stated in this file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-heap-memory.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-heap-memory.png" alt="java garbage collection heap memory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a result of properly configured options, the GC can be observed in action via the &lt;a href="https://docs.jelastic.com/view-app-statistics" rel="noopener noreferrer"&gt;Statistics&lt;/a&gt; tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-statistics.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fjava-garbage-collection-statistics.png" alt="java garbage collection statistics"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it! Enjoy resource efficiency while running your Java applications in the cloud. Try it yourself with &lt;a href="https://jelastic.cloud/" rel="noopener noreferrer"&gt;Jelastic Multi-Cloud PaaS&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>java</category>
      <category>garbagecollection</category>
      <category>garbagecollector</category>
      <category>javamemory</category>
    </item>
    <item>
      <title>Scaling Kubernetes on Application and Infrastructure Levels</title>
      <dc:creator>Tetiana Fydorenchyk</dc:creator>
      <pubDate>Thu, 08 Aug 2019 09:12:18 +0000</pubDate>
      <link>https://dev.to/tetiana_ftv/scaling-kubernetes-on-application-and-infrastructure-levels-5bfe</link>
      <guid>https://dev.to/tetiana_ftv/scaling-kubernetes-on-application-and-infrastructure-levels-5bfe</guid>
      <description>&lt;p&gt;Once an internal project from Google, Kubernetes has changed the way software development is done these days. A white steering wheel on a blue background seems to be everywhere now. Business wants to grow and pay less, DevOps want a stable platform that can run applications at scale, developers want reliable and reproducible flows to write, test and debug code. Kubernetes promises it all. Now that Jelastic offers &lt;a href="https://jelastic.com/blog/kubernetes-cluster-scaling-pay-per-use-hosting/" rel="noopener noreferrer"&gt;managed Kubernetes&lt;/a&gt;, spinning up a cluster can’t be easier.&lt;/p&gt;

&lt;p&gt;However, have you given some thoughts on how to get such a powerful container orchestration platform and pay just for resources that you actually need? This article will shed some light on horizontal and vertical scaling both on Jelastic (infra) and Kubernetes (application) level.&lt;/p&gt;

&lt;h1&gt;
  
  
  Scaling Kubernetes on Infrastructure Level
&lt;/h1&gt;

&lt;p&gt;A Kubernetes cluster typically consists of a master (or a couple of them) and multiple nodes where application pods are scheduled. The maths is quite simple here: the more applications you run in your cluster, the more resources (nodes) you need. Say, you have a microservices application consisting of 3 services, each started as an individual pod which requests 1GiB of RAM. It means that you will need a 4 GiB node (K8s components and OS will require some RAM too). What if you need additional RAM in case of high load, potential memory leaks or if you deploy more services to the cluster? Correct, you either need a larger node or add an additional node to the cluster. Usually in both cases, you will pay for the exact amount of resources that come with a VM (i.e. you will pay for, say, 3GiB of RAM even if half of it is unused). That’s not the case with Jelastic though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vertical Scaling of Kubernetes Nodes
&lt;/h2&gt;

&lt;p&gt;Let’s get back to maths. If the application roughly needs 3GiB of RAM, and there’s not much going on in the cluster, you need just one node. Sure thing, having some extra free RAM is always a good idea, so a 5GiB node makes a lot of sense.&lt;/p&gt;

&lt;p&gt;Again, not with Jelastic. What you can do is request a 3GiB node and have a 2GiB in stash. When your application (K8s pod) starts consuming more (which is configured on K8s side too) or you simply deploy more pods (as in the chart below), those 2 extra GiB become immediately available, and you start paying for those resources only when they are used.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fvertical-scaling-kubernetes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fvertical-scaling-kubernetes.png" alt="vertical scaling kubernetes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a result, you can do some simple math and figure out the best cluster topology: say, 3 nodes, with 4 GiB of reserved RAM and 3GiB of dynamic resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Horizontal Auto-Scaling of Kubernetes Nodes
&lt;/h2&gt;

&lt;p&gt;Having one huge node in a Kubernetes cluster is not a good idea since all deployments will be affected in case of an outage or any other major incident. Having several nodes in a stand-by mode is not cost efficient. Is it possible that Kubernetes adds a node when it needs it? Yes, a Kubernetes cluster in Jelastic can be configured with horizontal node auto-scaling. New nodes will be added to a cluster when RAM, CPU, I/O or Disk usage reaches certain levels. Needless to say, you get billed for additional resources only when they are used. Newly added nodes will be created according to current topology, i.e. existing vertical scaling configurations will be applied. The system will scale down as soon as resource consumption gets back to expected levels. Your Kubernetes cluster will not starve, yet you will not pay for unused resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fhorizontal-scaling-kubernetes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fhorizontal-scaling-kubernetes.png" alt="horizontal scaling kubernetes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scaling Kubernetes on Application Level
&lt;/h1&gt;

&lt;p&gt;Kubernetes has its own horizontal &lt;a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="noopener noreferrer"&gt;pod auto-scalers&lt;/a&gt; (HPA). In simple words, HPA will replicate chosen deployments based on utilization of CPU. If CPU consumption of all pods grows more than, say, 70%, HPA will schedule more pods, and when CPU consumption gets back to normal, deployment is scaled back to the original number of replicas.&lt;/p&gt;

&lt;p&gt;Why is this cool and how does it work with automatic horizontal scaling of Kubernetes nodes? Say, you have one node with a couple of running pods. All of a sudden, a particular service in the pod starts getting a lot of requests and performing some CPU costly operations. RAM utilization does not grow, and as a result at this point there is no mechanism to scale the application which will soon become unresponsive. Kubernetes HPA will scale up pods, and an internal K8s load balancer will redirect requests to healthy pods. Those new pods will require more resources, and this is where Jelastic horizontal and vertical scaling comes into play. New pods will be either placed on the same node and utilize dynamic RAM, or a new node will be added (in case there’s not enough resources on existing ones).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Kubernetes Scaling Out&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-out.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-out.png" alt="scaling kubernetes out"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Kubernetes Scaling In&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-in.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-in.png" alt="scaling kubernetes in"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On top of that, you may set resource caps on Kubernetes pods. For example, if you know for sure that a particular service should not consume more than 1GiB, and there’s a memory leak if it does, you instruct Kubernetes to kill the pod when RAM utilization reaches 1GiB. A new pod will start automatically. This gives you control over resources your Kubernetes deployments utilize.&lt;/p&gt;

&lt;h1&gt;
  
  
  Living Proof with WordPress Hosted in Kubernetes
&lt;/h1&gt;

&lt;p&gt;Now, let’s deploy a real-life application to a Kubernetes cluster to show all of the above mentioned scaling features. A WordPress site would be a great example. Huge Kubernetes community is one of its biggest advantages and adoption factors, so it’s really easy to find tutorials on how to deploy popular applications. Let’s go through the official &lt;a href="https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/" rel="noopener noreferrer"&gt;WordPress tutorial&lt;/a&gt; (non-production deployment is chosen for simplicity of this article, and you may deploy WordPress using helm charts).&lt;/p&gt;

&lt;p&gt;Once done, there is one more thing to do. We will need to create an Ingress bound to a WordPress service since access to running applications in Jelastic Kubernetes cluster is provided by Traefik reverse proxy.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;em&gt;wp-ingress.yaml&lt;/em&gt; with the following content:&lt;/p&gt;

&lt;p&gt;apiVersion: extensions/v1beta1&lt;br&gt;
kind: Ingress&lt;br&gt;
metadata:&lt;br&gt;
  labels:&lt;br&gt;
    app: wordpress&lt;br&gt;
  name: wp&lt;br&gt;
  annotations:&lt;br&gt;
    kubernetes.io/ingress.class: traefik&lt;br&gt;
    ingress.kubernetes.io/secure-backends: "true"&lt;br&gt;
    traefik.frontend.rule.type: PathPrefixStrip&lt;br&gt;
spec:&lt;br&gt;
  rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;http:
  paths:

&lt;ul&gt;
&lt;li&gt;path: /
backend:
  serviceName: wordpress
  servicePort: 80&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;After ingress is created, a WordPress site is available at &lt;em&gt;https://.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-welcome-wordpress.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-welcome-wordpress.png" alt="scaling kubernetes welcome wordpress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great, we have a running WordPress instance in a Kubernetes cluster. Let’s create horizontal pod auto-scalers (HPA) for WordPress deployment to make sure the service always responds despite high load. In your terminal, run:&lt;/p&gt;

&lt;p&gt;kubectl autoscale deployment wordpress --cpu-percent=30 --min=1 --max=10 -n wp&lt;/p&gt;

&lt;p&gt;Now, if WordPress pod starts utilizing &amp;gt;30% of CPU for all pods, autoscaler will modify deployment to add more pod replicas, so that an internal load balancer routes requests to different pods. Of course, chosen values are for demo purposes only and can be adjusted based on your needs.&lt;/p&gt;

&lt;p&gt;Next step is to review vertical and horizontal scaling options of a Jelastic Kubernetes environment. There are two main goals here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pay only for actually utilized resources&lt;/li&gt;
&lt;li&gt;Make sure Kubernetes cluster has a spare node when required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To make the demo simpler (i.e. run out of RAM faster), let’s configure the node to use up to 1.5GiB RAM and 4.8GHz CPU. Click &lt;em&gt;Change Environment Topology&lt;/em&gt; and state &lt;em&gt;Scaling Limit&lt;/em&gt; per node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-wordpress-topology-edit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-wordpress-topology-edit.png" alt="scaling kubernetes wordpress topology edit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configuration of an automatic horizontal scaling is the final step. Similar to vertical scaling, values are set to be promptly triggered to suit purposes of this demo. Let’s instruct Jelastic when to add and remove Kubernetes nodes. Open &lt;em&gt;Settings &amp;gt; Auto Horizontal Scaling&lt;/em&gt; and &lt;em&gt;Add&lt;/em&gt; a set of required triggers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-wordpress-horizontal-scaling.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-wordpress-horizontal-scaling.png" alt="scaling kubernetes wordpress horizontal scaling"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s take a look at memory consumption. Kubernetes node (Workers) uses 8 cloudlets with 4 more cloudlets that can be dynamically added, i.e. there is some RAM to schedule a few more pods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-added.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-added.png" alt="scaling kubernetes workers added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s time to put some stress on a WordPress site. There are multiple ways to initiate HTTP GET requests. We will use the simplest – wget in a while-true loop executed within WordPress pod itself (wordpress is a service name that will be resolved to an internal IP accessible from the cluster only):&lt;/p&gt;

&lt;p&gt;while true; do wget -q -O- &lt;a href="http://wordpress" rel="noopener noreferrer"&gt;http://wordpress&lt;/a&gt;; done&lt;/p&gt;

&lt;p&gt;A few moments later, we can observe the following data from HPA:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-hpa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-hpa.png" alt="scaling kubernetes hpa"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes autoscaler has modified WordPress deployment to add more replicas. Expectedly, the cluster does not have enough RAM, so as Kubernetes Dashboard suggests, the remaining 5 pods cannot be scheduled:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-required.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-required.png" alt="scaling kubernetes workers required"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few pods were able to start though, as Jelastic dynamically added cloudlets (RAM&amp;amp;CPU) to the node. However, the remaining 2 cloudlets were not enough for at least one more pod to start.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-lack-resources.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-lack-resources.png" alt="scaling-kubernetes-lack-resources"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is where the magic begins. Since we have configured automatic node auto scaling, Jelastic is adding a new node now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-automatic-workers-adding.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-automatic-workers-adding.png" alt="scaling kubernetes automatic workers adding"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s check if a new node is registered with master by running a simple command &lt;em&gt;kubectl get nodes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-kubectl-get-nodes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-kubectl-get-nodes.png" alt="scaling kubernetes kubectl get nodes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few moments later:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-new-workers-added.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-new-workers-added.png" alt="scaling kubernetes new workers added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fantastic! All pods have started which means WordPress can handle all those incoming requests that we have initiated a few minutes ago. Now, let’s abort this &lt;code&gt;while true&lt;/code&gt; command and wait for a minute or so. Replica count gets back to 1 again which means we do not need an additional node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-scaled-in.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-workers-scaled-in.png" alt="scaling kubernetes workers scaled in"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Memory utilization figures suggest that the node can be deleted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-have-resources.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-have-resources.png" alt="scaling-kubernetes-have-resources"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And Jelastic indeed removes it in about one minute.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-remove-worker.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-remove-worker.png" alt="scaling-kubernetes-remove-worker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What have we just witnessed? Let’s recap. Creating HPA for WordPress deployment initiates scheduling of more pod replicas to handle high load. It is up to application admin to configure triggers. Next, Jelastic dynamically allocates RAM within nodes. If you run out of RAM, a new node is added to the cluster. When resource utilization gets back to normal, HPA sets replica count back to 1, and Jelastic removes a node. When HPA scales up deployment again, Jelastic reacts accordingly. No extra RAM is in use at any time! No downtime!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-summary.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjelastic.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F08%2Fscaling-kubernetes-summary.png" alt="scaling kubernetes summary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With so many scaling options, both on cluster (infrastructure) and application (deployment/pod) level, a Kubernetes cluster in Jelastic becomes a smart platform that either grows or shrinks according to your application workloads. Kubernetes even checks if your application is up and running, and redeploys it if necessary with zero downtime when the application is being updated with new images, which makes continuous delivery a reality, not just a buzzword. Try out yourself at one of &lt;a href="https://jelastic.cloud/?featuresSupport=K8S&amp;amp;_ga=2.229140316.1727426656.1564915764-1869759705.1551013954" rel="noopener noreferrer"&gt;Jelastic public cloud service providers&lt;/a&gt; or request &lt;a href="https://jelastic.com/managed-auto-scalable-clusters-for-business/" rel="noopener noreferrer"&gt;private cloud installation with Kubernetes cluster&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>kubernetescluster</category>
      <category>kubernetesscaling</category>
    </item>
    <item>
      <title>Magento Cloud Hosting. How to Deploy E-Commerce Platform</title>
      <dc:creator>Tetiana Fydorenchyk</dc:creator>
      <pubDate>Wed, 31 Jul 2019 11:43:37 +0000</pubDate>
      <link>https://dev.to/tetiana_ftv/magento-cloud-hosting-how-to-deploy-e-commerce-platform-3ek7</link>
      <guid>https://dev.to/tetiana_ftv/magento-cloud-hosting-how-to-deploy-e-commerce-platform-3ek7</guid>
      <description>&lt;p&gt;The online shopping industry is gaining popularity all over the world, so e-commerce sites are extremely demanded nowadays. We can find many options available online to build and host an e-commerce website, but Magento cloud hosting is considered to be one of the most robust, flexible and scalable open source e-commerce platforms on the market. &lt;/p&gt;

&lt;p&gt;Magento includes a wide range of tools to build and manage an online store. It is well known in the developer community for its use of object-oriented programming (OOP) and especially for its use of the Entity–attribute–value (EAV) model. This allows Magento to be enough versatile at storing a large range of data.&lt;/p&gt;

&lt;p&gt;Magento can be automatically deployed and hosted in the cloud with the help of Jelastic PaaS. There are two installation packages with different web-servers used in the topology – NGINX or LiteSpeed. It’s pretty easy to get them up and running, just follow a few simple steps below.&lt;/p&gt;

&lt;p&gt;1.Enter the Jelastic dashboard, find the &lt;strong&gt;Magento Standalone&lt;/strong&gt; package in the &lt;a href="https://docs.jelastic.com/marketplace"&gt;Marketplace&lt;/a&gt; and press &lt;strong&gt;Install&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jJopTKTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/rkarj4m5b6238w9shdvl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jJopTKTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/rkarj4m5b6238w9shdvl.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6jm-2-IO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0b7o4bi7k0rkchc3vpx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6jm-2-IO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0b7o4bi7k0rkchc3vpx1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, you can &lt;a href="https://docs.jelastic.com/environment-import"&gt;import&lt;/a&gt; the Magento &lt;a href="https://github.com/jelastic-jps/magento/blob/master/magento/manifest.jps"&gt;manifest&lt;/a&gt; with the needed topology:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rRrkAv7H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ak3w1nw8lyrjua9qzfg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rRrkAv7H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ak3w1nw8lyrjua9qzfg6.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.In the opened popup dialog, specify the name of &lt;strong&gt;Environment&lt;/strong&gt; and choose the preferred &lt;strong&gt;&lt;a href="https://docs.jelastic.com/environment-regions"&gt;Region&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;If the installation of Magento on &lt;a href="https://docs.jelastic.com/litespeed-web-server"&gt;LiteSpeed Web Server&lt;/a&gt; is available on the chosen service provider, there will be the checkbox Install LiteSpeed High-Performance Web Server. And if you prefer &lt;a href="https://docs.jelastic.com/nginx-php"&gt;NGINX&lt;/a&gt;-based installation, just untick this option.&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;Install&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lyx1melA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0adseuf2rl99r6w2igvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lyx1melA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0adseuf2rl99r6w2igvp.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.Wait a few minutes till the installation is completed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cS8cO2Xt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/v3jhgtgq392avldldjem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cS8cO2Xt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/v3jhgtgq392avldldjem.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4.Follow the Magento environment link to open Magento welcome page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wtc6Z96J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kvu3f9u8m41buq9nvu9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wtc6Z96J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kvu3f9u8m41buq9nvu9m.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.Use credentials from the successful installation message or received email notification to access the admin panel and start managing your e-commerce platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ibwj4yDl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ao6pqam586jrdmgjbnpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ibwj4yDl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ao6pqam586jrdmgjbnpv.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B3KNmgCC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/o2e5u6bua6yopy51fcvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B3KNmgCC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/o2e5u6bua6yopy51fcvv.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything is set up and ready! Magento is not only user-friendly but also beneficial for merchants as they can manage multiple stores within a single admin panel. It is a perfect shopping cart that meets the requirements of today’s competitive business. Try it out yourself at one of public &lt;a href="https://jelastic.cloud/?featuresSupport=MG"&gt;Jelastic PaaS service providers&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We hope you found this post useful. If you have any experience with scalable Magento hosting please share your viewpoint in the comment section below.&lt;/p&gt;

</description>
      <category>magento</category>
      <category>magentocloudhosting</category>
      <category>magentoecommerce</category>
    </item>
    <item>
      <title>What is PaaS? Platform-as-a-Service Types Explained</title>
      <dc:creator>Tetiana Fydorenchyk</dc:creator>
      <pubDate>Tue, 16 Jul 2019 15:06:44 +0000</pubDate>
      <link>https://dev.to/tetiana_ftv/what-is-paas-platform-as-a-service-types-explained-384o</link>
      <guid>https://dev.to/tetiana_ftv/what-is-paas-platform-as-a-service-types-explained-384o</guid>
      <description>&lt;p&gt;There’s no single PaaS for everyone. Even the definition of this cloud computing service model is quite vague today. Commonly, it is described as a cloud hosting platform with a set of deployment and scaling automation, application management and DevOps tools that can be run on shared infrastructure or on-premise. Also, PaaS eliminates the complexity of building and maintaining the underlying infrastructure. Let’s see how PaaSes differ through the prism of their use cases and supported technologies, and how to determine which one will meet specific needs.&lt;/p&gt;

&lt;p&gt;Let’s take a closer look and analyze Platform-as-a-Service solutions from several angles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;purpose &lt;/li&gt;
&lt;li&gt;abstraction&lt;/li&gt;
&lt;li&gt;functionality&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuxs1riqb0t7ah007fszu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuxs1riqb0t7ah007fszu.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Purpose-Driven Categories of PaaS
&lt;/h2&gt;

&lt;p&gt;Today’s PaaS vendors bring innovative approaches to application development and their hosting in the cloud by providing various tools built specifically for a particular service. Considering use cases hosted within Platform-as-a-Service solutions, we can break down PaaS offerings into three broad categories: general-purpose, emerging and specialized. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;General-purpose&lt;/strong&gt; platforms are widely chosen for traditional stateful web and N-tier applications thus offering “lift and shift” approach for &lt;a href="https://jelastic.com/blog/shift-java-applications-to-containers-with-jelastic-paas/" rel="noopener noreferrer"&gt;migrating existing workloads&lt;/a&gt;. In addition, this PaaS type is timely expanding with modern technologies that meet the needs of stateless cloud-native applications and microservices, and help to develop new scalable and fault tolerant services.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emerging&lt;/strong&gt; PaaSes bring new approaches to the market. They are commonly used for development of independent services based on emerging technologies such as serverless, distributed event processing, machine learning frameworks, and others. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Specialized&lt;/strong&gt; platforms focus on narrow niche use cases but with high demand on the market. Such products have proved to be effective in different directions including e-commerce, big data processing and business applications. Often, these platforms are transformed into subcategories such as &lt;a href="https://jelastic.com/wordpress-enterprise-services/" rel="noopener noreferrer"&gt;CMSaaS&lt;/a&gt;, eCommerce-as-a-Service, &lt;a href="https://jelastic.com/blog/mysql-mariadb-database-auto-clustering-cloud-hosting/" rel="noopener noreferrer"&gt;DBaaS&lt;/a&gt;, BPaaS, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Abstraction Levels of PaaS
&lt;/h2&gt;

&lt;p&gt;PaaS solutions are increasingly focused on full-cycle automation of application deployment and delivery processes. This helps developers to focus more on application design and its implementation instead of time consuming routine or complex tasks, such as server and storage configuration, application and infrastructure security, auto scaling, load balancing, and so on. &lt;/p&gt;

&lt;p&gt;There can be considered three levels of PaaS abstraction: low, mid and high.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Low abstraction&lt;/strong&gt; level platforms, especially &lt;a href="https://jelastic.com/kubernetes-hosting/" rel="noopener noreferrer"&gt;Container-as-a-Service&lt;/a&gt; (CaaS) solutions, provide DevOps teams with deep access to infrastructure configurations, as well as granular control over containers and various platform services (e.g. service discovery, logging, security and load balancing). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mid abstraction&lt;/strong&gt; has the primary goal to let developers code without headache of infrastructure configuration and management. These platforms give developers access to a wide range of integrated and optimized development frameworks, middleware software stacks, APIs and services completely abstracted from CaaS and IaaS deployment properties. Very often such PaaS solutions provide &lt;a href="https://docs.jelastic.com/automatic-vertical-scaling" rel="noopener noreferrer"&gt;automatic scaling&lt;/a&gt;, load balancing, high-availability, backup, disaster recovery, CI/CD, and other application lifecycle management features out-of-box. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High abstraction&lt;/strong&gt; solutions are aimed to abstract even coding process to increase the application delivery speed and reduce the cost of innovations. In this case, developers get the entire technology stack but with full abstraction of application, platform and infrastructure levels. It helps to boost performance of team members and reduce requirements to their technical skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functionality and Services Integrated to PaaS
&lt;/h2&gt;

&lt;p&gt;In order to automate the application lifecycle management processes, PaaS represents a collection of configuration tools, continuous integration and delivery services, connectors and plugins to popular IDEs. &lt;/p&gt;

&lt;p&gt;We can highlight three main approaches in this category:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment Automation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PaaSes concentrated on providing tools and services for &lt;a href="https://jelastic.com/apaas/" rel="noopener noreferrer"&gt;deployment automation&lt;/a&gt; offering “one-click” or “git-push” functionality, as well as pre-configured environments for code building, continuous integration and project management tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure Management&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cloud platforms focused on infrastructure configuration, health and availability monitoring, security and performance checks, cost optimization, as well as offering automation and services related to upgrades and maintenance. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Container Orchestration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Container management platforms offering functionality to solve challenges of &lt;a href="https://jelastic.com/blog/containerization-devops/" rel="noopener noreferrer"&gt;containerization&lt;/a&gt; process and implementation of cloud-native approach for existing or new applications. Many PaaS vendors now offer CaaS as an integral component of their products, further reinforcing the view of PaaS as a collection of different DevOps tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the PaaS Choice
&lt;/h2&gt;

&lt;p&gt;There are several important points that should be considered before selecting a PaaS for a company. &lt;/p&gt;

&lt;p&gt;Above all, analyze if the chosen PaaS supports the technologies, middleware stacks and programming languages used by development teams today or planned to be used in the future. &lt;/p&gt;

&lt;p&gt;The next point to consider is vendor and data lock-in. Despite benefits some PaaSes offer, the access to the application itself and used middleware stacks can be very limited due to proprietary design of tools and services. This aspect affects the application portability. So migration to any other cloud or &lt;a href="https://jelastic.com/blog/multi-cloud-interoperability/" rel="noopener noreferrer"&gt;implementing multi-cloud interoperability&lt;/a&gt; approach becomes a real challenge. Same issue applies to the stored data. Ensure that PaaS provider allows to import/export data easily without any lock-in. &lt;/p&gt;

&lt;p&gt;They say there’s no “one-size-fits-all” technology for every project but in modern cloud world with all integrations and interconnections available the borders between specific products are blurring. Jelastic Multi-Cloud PaaS provides the required &lt;a href="https://jelastic.com/blog/turnkey-multi-cloud-paas-freedom/" rel="noopener noreferrer"&gt;freedom of choice&lt;/a&gt; when it comes to cloud services, DevOps tools and container management systems. &lt;a href="https://jelastic.com/" rel="noopener noreferrer"&gt;Give it a try&lt;/a&gt; to immensely improve development productivity and application delivery processes with minimal investment.&lt;/p&gt;

</description>
      <category>paas</category>
      <category>platformasaservice</category>
      <category>cloudplatform</category>
      <category>cloudcomputing</category>
    </item>
  </channel>
</rss>
