ELK stack

Performance tuning ELK stack

Building on my previous post describing how to quickly set up a centralized logging solution using the ElasticSearch + Logstash + Kibana (ELK) stack, we have a fully functioning, Docker based ELK stack agreggating and handling our logs.  The only problem is that performance is either waaay too slow or the stack seems to crash.  As I worked through this problem myself, I found a few settings that vastly improved the stability and performance of my ELK stack.

So in this post I will share some of the useful tweaks and changes that worked in my own environment to help squeeze additional performance out of the setup.

Hopefully these adjustments will help others!

Adjusting Logstash

Out of the box, Logstash does a pretty good job of setting things up with reasonable default values.  The main adjustment that I have found to be useful is setting the default number of Logstsash “workers” when the Logstash process starts.  A good rule of thumb would be one worker per CPU.  So if the server has 4 cpu’s, your Logstash start up command would look similar to the following.

/opt/logstash/bin/logstash --verbose -w 4 -f /etc/logstash/server.conf

The important bit to note is the “-w 4” part.  A poorly configured server.conf file may also lead to performance issues but that will be very specific to the user.  For the most part, unless the configuration contains many conditionals and expensive codec calls or excessive filtering, performance here should be stable.

If you are concerned about utilization I recommend watching cpu and memory consumption by the Logstash process, signs that there could be a configuration issue would be cpu maxing out.

The main thing to be aware of with a custom number of workers is that some codecs may not work properly because they are not thread safe.  If you are using the “multiline” codec in any of your inputs then you will not be able to leverage multiple workers, or if you are using multiple workers you won’t be able to use the codec until the thread safe problems have been fixed.  The good news is that this is a known issue and is being worked on, hopefully will be fixed by the time 1.5.0 is released.  It tripped me up initially and so I thought I would mention the issue.

Increase Java heap memory

It turns out that ElasticSearch is a bit of a memory hog once you start actually sending data through Logstash to have ES consume.  In my own testing, I discovered that logs would mysteriously stop being recorded in to ES and consequently would fail to show up in my dashboards.

The first tweak to make is to increase the amount of memory available to Java to process ES indices.  I have discovered that there is a script that ES uses to load up Java when it starts, which is passing in a value of 1GB of RAM to start.

After some digging, I discovered that the default ES configuration I was using was quickly running out of memory and was crashing because the ES heap memory couldn’t keep up with the load (mostly indexes).

Here is a sample of the errors I was seeing when ES and Logstash stopped processing logs.

message [out of memory][OutOfMemoryError[Java heap space]]

This was a good starting point for investigating.  Basically, what this means is that the ES container had a Java heap memory setting set to 1GB which was exhausting the the memory allocated to ES, even though there was much more memory available on the server.

To increase this memory limit, we will override this script with our own custom values.

This script is called “elasticsearch.sh.in” and we will be overriding the default value ES_MAX_MEM with a value of “4g” as show below.  The general guideline that has been recommended is to use a value here of about 50% of the total amount of memory.  So if your server has 8GB of memory then setting it to 4GB here will be the 50% we are looking for.

There are many other options that can be overridden but the most import value is the max memory value that we have updated.

We can inject this custom value as an environment variable in our Dockerfile which makes managing custom configurations much easier if we need to make additions or adjustments later on.

ENV ES_HEAP_SIZE=8g

I am posting the script that sets the values below as a reference in case there are other values you need to override.  Again, we can use use environmental variables to set these up in our Dockefile if needed.

#!/bin/sh

ES_CLASSPATH=$ES_CLASSPATH:$ES_HOME/lib/elasticsearch-1.5.0.jar:$ES_HOME/lib/*:$ES_HOME/lib/sigar/*

if [ "x$ES_MIN_MEM" = "x" ]; then
 ES_MIN_MEM=256m
fi
if [ "x$ES_MAX_MEM" = "x" ]; then
 ES_MAX_MEM=1g
fi
if [ "x$ES_HEAP_SIZE" != "x" ]; then
 ES_MIN_MEM=$ES_HEAP_SIZE
 ES_MAX_MEM=$ES_HEAP_SIZE
fi

# min and max heap sizes should be set to the same value to avoid
# stop-the-world GC pauses during resize, and so that we can lock the
# heap in memory on startup to prevent any of it from being swapped
# out.
JAVA_OPTS="$JAVA_OPTS -Xms${ES_MIN_MEM}"
JAVA_OPTS="$JAVA_OPTS -Xmx${ES_MAX_MEM}"

# new generation
if [ "x$ES_HEAP_NEWSIZE" != "x" ]; then
 JAVA_OPTS="$JAVA_OPTS -Xmn${ES_HEAP_NEWSIZE}"
fi

# max direct memory
if [ "x$ES_DIRECT_SIZE" != "x" ]; then
 JAVA_OPTS="$JAVA_OPTS -XX:MaxDirectMemorySize=${ES_DIRECT_SIZE}"
fi

# set to headless, just in case
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"

# Force the JVM to use IPv4 stack
if [ "x$ES_USE_IPV4" != "x" ]; then
 JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
fi

JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"

JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"

# GC logging options
if [ "x$ES_USE_GC_LOGGING" != "x" ]; then
 JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
 JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
 JAVA_OPTS="$JAVA_OPTS -XX:+PrintClassHistogram"
 JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution"
 JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
 JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
fi

# Causes the JVM to dump its heap on OutOfMemory.
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
# The path to the heap dump location, note directory must exists and have enough
# space for a full heap dump.
#JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof"

# Disables explicit GC
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"

# Ensure UTF-8 encoding by default (e.g. filenames)
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

Then when Elasticsearch starts up it will look for this custom configuration script and start Java with the desired 4GB of memory.  This is one easy way to squeeze performance out of your server without making any other changes or modifying your server.

Modify Elasticsearch configuration

This one is also very easy to put in to place.  We are already using the elasticsearch.yml so the only thing that needs to be done is to create some additional configurations to this file, rebuild the container, and restart the ES container with the updated values.

A good setting to configure to help control ES memory usage is to set the indices field cache size.  Limiting this indices cache size makes sense because you rarely need to retrieve logs that are older than a few days.  By default ES will hold old indices in memory and will never let them go.  So unless you have unlimited memory than it makes sense to limit the memory in this scenario.

To limit the cache size simply add the following value anywhere in your custom elasticsearch.yml configuration file.  This setting and adjusting the Java heap memory size should be enough to get started but there are a few other things that might be worth checking.

indices.fielddata.cache.size:  40%

If you only make one change, add this line to your ES configuration!  This setting will let go of the oldest indices first so you won’t be dropping new indices, 9/10 times this is probably what you want when accessing data in Logstash.  More information about controlling memory usage can be found here.

Another idea worth looking at for an easy performance boost would be disabling swap if it has been enabled.  Again, in most cloud environment and images swap is turned off, but it is always a setting worth checking.

To bypass the OS swap setting you can simply configure a no swap value in ES by adding the following to your elasticsearch.yml configurtion file.

bootstrap.mlockall: true

To check that this has value has been configured properly you can run this command.

curl http://localhost:9200/_nodes/process?pretty

This may cause memory warnings when ES starts up (eg, nuable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit).) but you should be able to ignore these warnings.  If you are concerned, turn these limits off at the OS level which is demonstrated below.

Misc

Other low hanging fruit includes disabling open file limits on the OS.  ES can run in to problems if there is a cap on the amount of files that its processes can open or have open at a time.  I have run in to open file limit issues before and they are never fun to deal with.  This shouldn’t be an issue if you are running ES in a Docker container with the Ubuntu 14.04 base image.

If you aren’t sure about the open file limits for ES you can run the following command to get a better idea of the current limits.

ulimit -n

Make sure both the soft and hard limits are either set to unlimited or to an extremely high number.

This should take care of most if not all of the stability issues.  After putting these changes in place in my own environment I went from multiple crashes per day to so far none in over a week.  If you are still experiencing issues you might want to take a look at the ES production deployment guide for help or the #logstash and #elasticsearch IRC channels on freenode.

Read More

Jak uzyska? dost?p do Spinamba Casino: Przewodnik po Spinamba Casino Login, Logowanie i Aplikacja

Spinamba Casino to jedno z najpopularniejszych kasyn online dost?pnych dla graczy na ca?ym ?wiecie. Dzi?ki Kasyno Spinamba gracze mog? cieszy? si? ró?norodno?ci? gier oraz atrakcyjnymi bonusami. W tym artykule omówimy, jak wykona? Spinamba Casino Login i korzysta? z ró?nych us?ug oferowanych przez kasyno.

Proces Logowania w Spinamba Casino

Aby zalogowa? si? do Spinamba Kasyno, najpierw nale?y odwiedzi? stron? g?ówn? kasyna. Kliknij przycisk logowania, który zazwyczaj znajduje si? w prawym górnym rogu strony. Je?eli jeszcze nie masz konta, mo?esz si? zarejestrowa?, co zajmie tylko kilka minut.

Spinamba Aplikacja: Korzystaj z Kasyna na Urz?dzeniach Mobilnych

Kasyno Spinamba oferuje tak?e aplikacj? mobiln?, któr? mo?esz pobra? na swojego smartfona. Aplikacja jest ?atwa w u?yciu i pozwala cieszy? si? ulubionymi grami w ka?dej chwili.

Us?uga Opis
Spinamba Logowanie Proces szybkiego logowania do kasyna
Spinamba Aplikacja Aplikacja mobilna dla lepszej dost?pno?ci

Dzi?ki Spinamba, gracze mog? cieszy? si? https://spinambakasyno.com/ na ró?nych urz?dzeniach, co sprawia, ?e jest to wygodna platforma dla ka?dego u?ytkownika.

Gry i Bonusy

Kasyno Spinamba oferuje szeroki wachlarz gier, w tym sloty, gry sto?owe, a tak?e gry z krupierem na ?ywo. Po zalogowaniu si? do kasyna mo?na równie? skorzysta? z wielu promocji oraz bonusów, które s? regularnie aktualizowane.

Kasyno Spinamba

Niezale?nie od tego, czy jeste? pocz?tkuj?cym, czy do?wiadczonym graczem, Spinamba Casino ma co? dla ka?dego. Zarejestruj si? ju? dzi? i ciesz si? nieograniczonymi mo?liwo?ciami, jakie oferuje kasyno online!

Read More

How to Maximize Your Experience with SpinBet Casino

In recent years, online casinos have experienced exponential growth, and SpinBet Casino has emerged as a prominent name in this vibrant industry. For gaming enthusiasts looking to enhance their online gaming experience, understanding how to fully leverage the features of SpinBet Casino and the SpinBet app can make a significant difference. This article aims to uncover practical strategies to get the most value and enjoyment from SpinBet Casino.

Getting Started with SpinBet Casino

Embarking on your journey with SpinBet involves a few initial steps, essential for laying a strong foundation. After registering on the platform, it’s important to complete all necessary verifications to ensure account security and eligibility for bonuses.

Understanding SpinBet Promo Codes

SpinBet offers a range of promo codes designed to enhance your gaming experience by providing additional funds or spins. To maximize these bonuses, it’s crucial to check for promo codes regularly and understand the conditions attached. This includes wagering requirements, time limits, and eligible games. Knowing these details can greatly impact your strategy and potential winnings.

Why Use the SpinBet App?

The SpinBet app offers the convenience of seamless gaming on-the-go, allowing players to enjoy their favorite games anytime and anywhere. With its user-friendly interface, the app ensures a smooth, hassle-free gaming experience. It also features instant access to new games, promotions, and account management tools.

SpinBet Homepage

Another significant advantage of the app is the exclusive app-only promotions, which can be unlocked simply by downloading and using the app. This incentivizes more frequent engagement and potential extra bonuses unavailable through the desktop version.

Strategies for Playing Responsibly and Effectively

To enjoy SpinBet Casino to its fullest, establishing effective gaming strategies is key. Here are some practical tips:

  • Set a Budget: Before starting, decide on a specific budget for gaming. Stick to it to prevent overspending and ensure gaming remains a fun activity.
  • Learn the Games: Each game has its nuances, rules, and strategies. Spend time learning these aspects, and if available, use demo versions to practice without risk.
  • Leverage Bonuses Wisely: Take full advantage of bonuses by reading terms and conditions thoroughly. This way, you can strategically utilize them to boost your bankroll.
  • Set Winning and Losing Limits: Decide beforehand the amount at which you are comfortable cashing out to avoid chasing losses.

Navigating SpinBet’s Game Selection

SpinBet Casino offers a wide variety of games ranging from traditional slots to live dealer experiences. Exploring this diversity can significantly enhance your entertainment value and potential earnings. Consider trying out different game types to find what best suits your preferences. Each game type offers unique rewards and modes of play, from the fast-paced excitement of slots to the strategic depth of table games.

Live Dealer Games

For those seeking an authentic casino atmosphere, SpinBet’s live dealer games replicate the experience of being in a high-end casino. Interacting with live dealers and other players adds a social element often missed in online gaming, enriching the overall experience.

Secure and Convenient Payment Options

SpinBet Casino supports a range of secure payment methods, including credit cards, e-wallets, and bank transfers. Understanding these options can help ensure a smooth transaction process. Moreover, keep track of transaction times and any potential fees, as this varies across methods and can impact your budget planning.

Conclusion: Enhancing Your SpinBet Journey

Maximizing your experience with SpinBet Casino is all about smart strategies, understanding the platform’s features, and responsible gaming. By being strategic about bonuses and utilizing the SpinBet app’s unique offerings, you can enhance both your enjoyment and potential earnings. Always stay informed about the latest promotions and updates, ensuring that you continue to derive the utmost value from your gaming sessions.

Read More

Casumo: Descubre el Fascinante Mundo del Casino Casumo Online

Bienvenido al increíble mundo de Casumo Casino, una plataforma de apuestas en línea que ha revolucionado la manera en que los jugadores disfrutan de sus juegos favoritos. Desde su fácil Casumo login hasta una aplicación móvil innovadora, Casumo app, este casino en línea ofrece una experiencia inolvidable para cada usuario en busca de emocionantes oportunidades de juego.

Casumo Casino

El casino Casumo no solo proporciona una extensa variedad de juegos, sino también ofrece bonos atractivos para que los jugadores aumenten sus posibilidades de ganar. Todos los detalles sobre el Casumo bonus y otras sorprendentes ofertas están disponibles directamente desde el sitio web oficial. ¡No te lo pierdas!

La Experiencia de Apuestas en Casumo

Optar por Casumo apuestas significa disfrutar de una experiencia de usuario personalizada que se adapta a las necesidades de cada jugador. La plataforma en línea está diseñada con una interfaz intuitiva que facilita la navegación, asegurando que los usuarios puedan concentrarse en lo que realmente importa: el juego.

Gracias a la disponibilidad de Casumo online y Casumo casino online, los jugadores pueden acceder a sus juegos favoritos desde la comodidad de sus hogares o mientras están en movimiento, gracias a la Casumo app. Las oportunidades de juego son infinitas, y cada usuario encontrará algo que despierte su interés.

Seguridad y Soporte en Casumo

Asistencia Disponibilidad
Chat en Vivo 24/7
Email Soporte Rápido
FAQs Siempre Accesibles

La seguridad es una prioridad en Casumo online casino. Los jugadores pueden estar seguros de que sus datos están protegidos y que el juego limpio está garantizado. Además, el soporte al cliente está disponible 24/7 para resolver cualquier duda que pueda surgir.

Con un diseño responsivo y un equipo de soporte dedicado, Casumo se asegura de que la experiencia de juego sea emocionante y sin problemas. Para aquellos interesados en descubrir más sobre este fascinante mundo, Casumo Casino es sin duda una excelente elección.

¿A qué esperas? Explora el fascinante mundo del casino Casumo hoy mismo y aprovecha todas las ofertas y juegos increíbles que tienen para ofrecerte. ¡Buena suerte!

Read More

Betsafe, Betsafe Casino i Betsafe pl — praktyczny przewodnik dla graczy w Polsce

Je?li rozwa?asz gr? w Betsafe Casino, ten tekst daje konkretne wskazówki: jak szybko oceni? ofert?, zabezpieczy? konto i zarz?dza? bud?etem, by gra by?a bezpieczna i op?acalna. Bez ogólników — tylko to, co przyda si? przy pierwszych sesjach i przy podejmowaniu decyzji o depozycie.

1. Szybkie kryteria oceny

  • Licencja i regulacje: sprawd?, czy operator dzia?a legalnie w Polsce i jakie ma warunki wyp?at.
  • RTP i ró?norodno?? gier: priorytetem s? sloty z wysokim RTP oraz gry sto?owe od renomowanych dostawców.
  • Metody p?atno?ci: czy dost?pne s? szybkie przelewy, portfele elektroniczne i jasne limity wyp?at?

2. Jak za?o?y? i zabezpieczy? konto

Proces rejestracji w Betsafe Casino zwykle wymaga weryfikacji to?samo?ci. Przygotuj skan dokumentu i zdj?cie do weryfikacji. Ustaw silne, unikatowe has?o i w??cz dwusk?adnikowe uwierzytelnianie, je?li platforma je oferuje. Krótkie, ale wa?ne: nie u?ywaj tego samego logowania w kilku serwisach.

3. Bonusy — jak czyta? regulaminy

Bonusy kusz?, ale warunki obrotu potrafi? zniweczy? korzy?ci. Zwró? uwag? na:

  • wymóg obrotu (x razy),
  • ograniczenia gier do obrotu (np. sloty 100%, blackjack 5%),
  • maksymaln? stawk? przy grze za bonusowe ?rodki.

4. Zarz?dzanie bankrollem — praktyczny plan

Ustal dzienny lub sesyjny limit pora?ki i trzymaj si? go. Przyk?ad prosty do zastosowania: maksymalna strata 5% miesi?cznego bud?etu na rozrywk?, pojedyncza sesja — 1% bud?etu. To eliminuje emocjonalne decyzje po serii przegranych.

5. Najcz?stsze b??dy i jak ich unikn??

  • Granie „na odrabianie” — zatrzymaj si? po dwóch przegranych sesjach.
  • Brak weryfikacji warunków bonusu — czytaj regulaminy.
  • Niedba?e zabezpieczenia konta — w??cz 2FA i u?ywaj mened?era hase?.

Praktyczny takeaway: zanim wp?acisz pieni?dze, zrób szybki checklist: licencja, metody p?atno?ci, warunki bonusu, zabezpieczenia konta i plan bankrolu. Je?li chcesz wej?? na stron? rejestracji, u?yj tego linku: Betsafe pl.

Betsafe Casino

Read More