Tuesday, May 29, 2018

Optimizations I did

1) Made calls Async from Sync which brought down time from 118 msec to 38 msec per call.
2) Increased the number of threads for Kafka ( also increasing the partitions). Existing system was not creating enough threads and as the work performed was IO bound there should have been more threads.
3) StackOverflow exceptions and Out of Memory errors in toString fixed with rope and Charsequence.
4) Elasticsearch enabled the snitch at driver level for equitable distribution of load.
5) Used Hashmap instead of ArrayList for contains in operation.

Friday, April 13, 2018

Setting the limits in Linux permanently

https://singztechmusings.wordpress.com/2011/07/11/ulimit-how-to-permanently-set-kernel-limits-in-linux/


app soft nofile 16384
* hard memlock unlimited
elasticsearch hard memlock unlimited

root soft memlock unlimited
root hard memlock unlimited
#RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
elasticsearch soft RLIMIT_MEMLOCK 65536
elasticsearch hard RLIMIT_MEMLOCK 65536


 /etc/security/limits.conf I have set:
elasticsearch - nofile 65535
elasticsearch - memlock unlimited
root - memlock unlimited
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
docker - nofile 65535
docker - memlock unlimited
docker soft memlock unlimited
docker hard memlock unlimited
user hard memlock unlimited
user soft memlock unlimited
user - memlock unlimited

Monday, April 9, 2018

Difference between notify and notifyAll

package com.csco;


class ChildThread implements Runnable{
    private Object object;
    private String threadname;

    public ChildThread(Object object, String threadname) {
        this.object = object;
        this.threadname = threadname;
    }

    public void run(){
        synchronized (object){
            try {
                Thread.sleep(1000);
                System.out.println("This thread "+ threadname +" going to wait "+System.nanoTime());
                object.wait();
                System.out.println("This thread "+ threadname +" notified "+System.nanoTime());
              //  object.notifyAll();            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }
}


public class MainThread {
    public static void main(String[] args) {
        Object obj = new Object();
        ChildThread th1 = new ChildThread(obj,"thread1");
        ChildThread th2 = new ChildThread(obj,"thread2");
        ChildThread th3 = new ChildThread(obj,"thread3");
        ChildThread th4 = new ChildThread(obj,"thread4");
        ChildThread th5 = new ChildThread(obj,"thread5");

        new Thread(th1).start();
        new Thread(th2).start();
        new Thread(th3).start();
        new Thread(th4).start();
        new Thread(th5).start();

        try {
            Thread.sleep(6000);
            synchronized (obj) {
                obj.notify(); // Change this to notifyAll to see the difference                
                System.out.println("Done");
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

Friday, March 23, 2018

Really Advance Java



      https://stackoverflow.com/questions/37572095/self-referencing-generics-in-java
      http://freddy33.blogspot.com/2007/05/why-java-enum-cannot-extends.html
     

Monday, March 12, 2018

Thursday, March 8, 2018

TransportSerializationException[Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.state.ClusterStateResponse]]; nested: IndexOutOfBoundsException[Readable byte limit exceeded: 1031];

TransportSerializationException[Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.state.ClusterStateResponse]]; nested: IndexOutOfBoundsException[Readable byte limit exceeded: 1031];


Solution : Make sure Transportclient and Elasticsearch versions are compatible.

Optimizations I did

1) Made calls Async from Sync which brought down time from 118 msec to 38 msec per call. 2) Increased the number of threads for Kafka ( als...