ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tracel <tracelister....@gmail.com>
Subject Re: How to troubleshoot a slow client node get()
Date Tue, 19 Jul 2016 11:25:16 GMT
Thanks Yakov and sorry for late reply.

I tried to disable the shared memory communication and it seems working fine
so far:

    public class App {
    	public static void main(String[] args) {
		    System.out.println("ver 0719-1933");
    		App app = new App();
		    app.run();
	    }
    
	    private void run() {
		    readCache();
	    }
    
	    private void readCache() {
		    String cacheNamePrefix = "FOO";
    
		    TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
    		TcpDiscoveryMulticastIpFinder ipFinder = new
TcpDiscoveryMulticastIpFinder();
		    ipFinder.setMulticastGroup("228.10.11.166");
    		discoverySpi.setIpFinder(ipFinder);
    
		    TcpCommunicationSpi commumicationSpi = new TcpCommunicationSpi();
    		commumicationSpi.setSharedMemoryPort(-1);
    
		    IgniteConfiguration cfg = new IgniteConfiguration();
    		cfg.setDiscoverySpi(discoverySpi);
		    cfg.setCommunicationSpi(commumicationSpi);
    
		    Ignition.setClientMode(true);
    		Ignite ignite = Ignition.start(cfg);
		    try {
			    String cacheName = cacheNamePrefix + "." + Merchant.class.getName();
    			IgniteCache<String, Merchant> cache =
ignite.getOrCreateCache(cacheName);
    
			    readCache(cache);
		    } finally {
			    ignite.close();
		    }
	    }
    
	    private void readCache(IgniteCache<String, Merchant> cache) {
		    int sleepIntervalInMin = 3;
    
		    while (sleepIntervalInMin < 30) {
			    try {
				    timeACacheRead(cache);
    
				    Thread.sleep(1000 * 60 * sleepIntervalInMin++);
			    } catch (InterruptedException e) {
				    e.printStackTrace();
			    }
		    }
	    }
    
	    private void timeACacheRead(IgniteCache<String, Merchant> cache) {
		    SimpleDateFormat dateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
    
		    System.out.println(dateFormat.format(new Date()) + " before read");
    		Merchant merchant = cache.get("BAR");
		    System.out.println("merchant=" + merchant);
    		System.out.println(dateFormat.format(new Date()) + " after read");
	    }
    
    }

and the read timing:

    [19:14:23] Topology snapshot [ver=14, servers=1, clients=1, CPUs=1,
heap=1.7GB]
    2016-07-19T19:14:23.850+0800 before read
    log4j:WARN No appenders could be found for logger (org.jboss.logging).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
    merchant=com.foo.entity.Merchant@3e08ff24
    2016-07-19T19:14:24.147+0800 after read
    2016-07-19T19:17:24.147+0800 before read
    merchant=com.foo.entity.Merchant@4d1c005e
    2016-07-19T19:17:24.180+0800 after read
    2016-07-19T19:21:24.180+0800 before read
    merchant=com.foo.entity.Merchant@8462f31
    2016-07-19T19:21:24.202+0800 after read
    2016-07-19T19:26:24.202+0800 before read
    merchant=com.foo.entity.Merchant@24569dba
    2016-07-19T19:26:24.210+0800 after read
    2016-07-19T19:32:24.210+0800 before read
    merchant=com.foo.entity.Merchant@5ddeb7cb
    2016-07-19T19:32:24.218+0800 after read

I will try to test it for a longer time.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-troubleshoot-a-slow-client-node-get-tp6250p6386.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message