Wednesday, December 16, 2020

Reading the GC Events



Real: wall clock time – time from start to finish of the call.
User: the amount of CPU time spent in user-mode code (outside the kernel) within the process.
Sys: the amount of CPU time spent in the kernel within the process.

More:https://blog.gceasy.io/2016/12/08/real-time-greater-than-user-and-sys-time/

Elastic Search Cluster Management

Steps to do rolling restart of ES cluster:
  • sudo su root
  • docker ps -a
  • docker stop/start <I_ID>
  • docker exec -it <IMG_Id> /bin/bash
  • ps -ef | grep ‘keyword’
  • kill – 15 <P_ID> //SIGTERM signal termination message
  • reboot
  • https://www.elastic.co/guide/en/elasticsearch/reference/current/restart-cluster.html#restart-cluster-rolling
  • ping host_name -> get IP
  • kill -9 <P_ID>
Querying cluster details :
GET _cat/indices
GET _cat/aliases

Index settings GET INDEX_NAME/_settings

Wednesday, December 9, 2020

Streams Cookbook

1.  Stream to Map

Map<Integer, String> result3 = list.stream().collect(
Collectors.toMap(x -> x.getId(), x -> x.getName()));

Map<String, Long> result2 = list.stream().collect(
Collectors.toMap(Hosting::getName, Hosting::getWebsites));

List<DataType> newList stream() .map(item -> { if (something) {
return item.get(bar).toString();
} else {
return item.somOtherObject;}}).collect(Collectors.toList());

Collector : 
    -Alternative to removal  through iterator.