[ 
https://issues.apache.org/jira/browse/IGNITE-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Konstantinov updated IGNITE-1256:
---------------------------------------
    Description: 
Start server node with partitioned cache with near cache.
Put some keys.
Start visor and verify heap memory size metric for cache.

{code}
public class CachePutGetExample {
    /**
     * Executes example.
     *
     * @param args Command line arguments, none required.
     * @throws IgniteException If example execution failed.
     */
    public static void main(String[] args) throws IgniteException {
        try (Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml")) {
            try
            {
                NearCacheConfiguration<Integer, String> nCfg = new 
NearCacheConfiguration<Integer, String>();
                nCfg.setNearEvictionPolicy(new LruEvictionPolicy<Integer, 
String>(100));
                CacheConfiguration<Integer, String> cfg = new 
CacheConfiguration<Integer, String>("myCache");
                cfg.setNearConfiguration(nCfg);
//                cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
                IgniteCache<Integer,String> cache = 
ignite.getOrCreateCache(cfg);

                // Individual puts and gets.
                System.out.println();
                System.out.println(">>> Cache put-get example started.");

                final int keyCnt = 20000;

                // Store keys in cache.
                for (int i = 0; i < keyCnt; i++)
                    cache.put(i, Integer.toString(i));

                System.out.println(">>> Stored values in cache.");

                for (int i = 0; i < keyCnt; i++)
                    System.out.println("Got [key=" + i + ", val=" + 
cache.get(i) + ']');

                try {
                    Thread.sleep(1000000000);
                }
                catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }

{code}

  was:
Start server node with partitioned cache with near cache.
Put some keys.
Verify heap memory size metric.

{code}
public class CachePutGetExample {
    /**
     * Executes example.
     *
     * @param args Command line arguments, none required.
     * @throws IgniteException If example execution failed.
     */
    public static void main(String[] args) throws IgniteException {
        try (Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml")) {
            try
            {
                NearCacheConfiguration<Integer, String> nCfg = new 
NearCacheConfiguration<Integer, String>();
                nCfg.setNearEvictionPolicy(new LruEvictionPolicy<Integer, 
String>(100));
                CacheConfiguration<Integer, String> cfg = new 
CacheConfiguration<Integer, String>("myCache");
                cfg.setNearConfiguration(nCfg);
//                cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
                IgniteCache<Integer,String> cache = 
ignite.getOrCreateCache(cfg);

                // Individual puts and gets.
                System.out.println();
                System.out.println(">>> Cache put-get example started.");

                final int keyCnt = 20000;

                // Store keys in cache.
                for (int i = 0; i < keyCnt; i++)
                    cache.put(i, Integer.toString(i));

                System.out.println(">>> Stored values in cache.");

                for (int i = 0; i < keyCnt; i++)
                    System.out.println("Got [key=" + i + ", val=" + 
cache.get(i) + ']');

                try {
                    Thread.sleep(1000000000);
                }
                catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }

{code}


> Zero heap metrics for cache with near cache
> -------------------------------------------
>
>                 Key: IGNITE-1256
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1256
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: ignite-1.4
>            Reporter: Pavel Konstantinov
>            Assignee: Yakov Zhdanov
>
> Start server node with partitioned cache with near cache.
> Put some keys.
> Start visor and verify heap memory size metric for cache.
> {code}
> public class CachePutGetExample {
>     /**
>      * Executes example.
>      *
>      * @param args Command line arguments, none required.
>      * @throws IgniteException If example execution failed.
>      */
>     public static void main(String[] args) throws IgniteException {
>         try (Ignite ignite = 
> Ignition.start("examples/config/example-ignite.xml")) {
>             try
>             {
>                 NearCacheConfiguration<Integer, String> nCfg = new 
> NearCacheConfiguration<Integer, String>();
>                 nCfg.setNearEvictionPolicy(new LruEvictionPolicy<Integer, 
> String>(100));
>                 CacheConfiguration<Integer, String> cfg = new 
> CacheConfiguration<Integer, String>("myCache");
>                 cfg.setNearConfiguration(nCfg);
> //                cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
>                 IgniteCache<Integer,String> cache = 
> ignite.getOrCreateCache(cfg);
>                 // Individual puts and gets.
>                 System.out.println();
>                 System.out.println(">>> Cache put-get example started.");
>                 final int keyCnt = 20000;
>                 // Store keys in cache.
>                 for (int i = 0; i < keyCnt; i++)
>                     cache.put(i, Integer.toString(i));
>                 System.out.println(">>> Stored values in cache.");
>                 for (int i = 0; i < keyCnt; i++)
>                     System.out.println("Got [key=" + i + ", val=" + 
> cache.get(i) + ']');
>                 try {
>                     Thread.sleep(1000000000);
>                 }
>                 catch (InterruptedException e) {
>                     e.printStackTrace();
>                 }
>             }
>             catch (Exception e)
>             {
>                 e.printStackTrace();
>             }
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to