You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Naveen <na...@gmail.com> on 2018/10/24 10:54:23 UTC

Cache stats like number of cache hits, misses, reads, write, avg

Hi

We are using Ignite 2.5/2.6

Have enables stats collection by setting this property 

<property name="statisticsEnabled" value="true"/>

Created cache, and ran some Gets on it, and when we check stats thru visor,
we dont see any stats for read

cache -c=CustomerCache -a

All the columns like Hits, Writes, Reads are showing as zero, is there
anything we should do to capture stats.

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

DataStreamer depends on the allowOverwrite flag.

https://apacheignite.readme.io/docs/data-streamers#section-allow-overwrite

The default value is false to get the best performance. But it also means
that metrics will not be updated.

If you set allowOverwrite true then data streamer will work similar to usual
cache operation and metrics should work fine in this case.

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by Naveen <na...@gmail.com>.
HI Andrei 

It worked after enabling metrics at both egionCfg and storageCfg and also
enabling cacheMetrics for the cache. 

Stats are getting captured when we insert it thru cache.Put/putall , not
getting captured the data inserted thru datastreamer

| CustomerCharsCache(@c11)            | PARTITIONED | 6     | min: 5849433
(0 / 5849433)            | min: 0       | min: 21     | min: 21      | min:
12891798    |
|                                     |             |       | avg:
6789912.00 (0.00 / 6789912.00)   | avg: 0.00    | avg: 47.17  | avg: 47.17  
| avg: 13579824.00 |
|                                     |             |       | max: 7441242
(0 / 7441242)            | max: 0       | max: 79     | max: 79      | max:
14560907    |

Below cache, we have inserted data thru data streamer, we dont see any stats
below

 CustomerEntCache(@c12)              | PARTITIONED | 6     | min: 85799090
(0 / 85799090)          | min: 0       | min: 0      | min: 0       | min: 0          
|
|                                     |             |       | avg:
99619725.17 (0.00 / 99619725.17) | avg: 0.00    | avg: 0.00   | avg: 0.00   
| avg: 0.00        |
|                                     |             |       | max: 109158877
(0 / 109158877)        | max: 0       | max: 0      | max: 0       | max: 0          
|
+-------------------------------------+-------------+-------+---------------------------------------+--------------+-------------+--------------+------------------+

Also, we are using a cache-template like below, here I was trying to enable
cacheMetrics like below

     <bean id="cache-template"
                class="org.apache.ignite.configuration.CacheConfiguration"
                abstract="true">
        <property name="name" value="EDIFCache*" />
        *<property name="statisticsEnabled" value="true"/>*
        <property name="rebalanceBatchSize" value="#{16 * 1024 * 1024}"/>
        <property name="writeSynchronizationMode"
                        value="PRIMARY_SYNC " />
        <property name="affinity">
            <bean
                               
class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                <property name="excludeNeighbors" value="true" />
            </bean>
        </property>
    </bean>

Applying this template while definiting the cache like below, but still
statistics are not enables for cache.


 <bean class="org.apache.ignite.configuration.CacheConfiguration"
parent="cache-template">
                    <property name="name" value="AccountCache" />
                    <property name="cacheMode" value="PARTITIONED" />
</bean>

So I had to add this to each cache to enable statistics at cache level. Cant
we just add it to the template and use this template where you need this
setting enabled.

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

Try to set setMetrcis for both regionCfg and storageCfg too. Is it help?

BR,
Andrei 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by Naveen <na...@gmail.com>.
I guess I was doing the same.
Only change I could see is, you were enabling setMetrcis for both regionCfg
and storageCng

       regionCfg.setMetricsEnabled(true);
        // Setting the data region configuration.
        storageCfg.setDataRegionConfigurations(regionCfg);
        storageCfg.setMetricsEnabled(true);

I have attached, wont be able to upload the files..

But here the content, server-config.xml we use to start the Ignite node
Begin serve XML ===========================================
<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans                           
http://www.springframework.org/schema/beans/spring-beans.xsd                           
http://www.springframework.org/schema/util                           
http://www.springframework.org/schema/util/spring-util.xsd">
    
    <bean id="placeholderConfig"
	
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="file:${PROPERTY_FILE_PATH}" />
    </bean>
    <bean id="cache-template"
		class="org.apache.ignite.configuration.CacheConfiguration"
		abstract="true">
        <property name="name" value="EDIFCache*" />
        <property name="writeSynchronizationMode"
			value="PRIMARY_SYNC " />
        <property name="affinity">
            <bean
			
class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                <property name="excludeNeighbors" value="true" />
            </bean>
        </property>
    </bean>
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="igniteInstanceName" value="${IGNITE_INSTANCE_NAME}"
/>
        <property name="metricsLogFrequency" value="0" />
        <property name="failureDetectionTimeout" value="120000" />
        <property name="clientFailureDetectionTimeout" value="120000" />
        <property name="networkTimeout" value="120000" />
	
        <property name="gridLogger">
            <bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
                <constructor-arg type="java.lang.String"
value="${IGNITE_SCRIPT}/ignite-log4j2.xml" />
            </bean>
        </property>
        <property name="dataStorageConfiguration">
            <bean
				class="org.apache.ignite.configuration.DataStorageConfiguration">
                <property name="defaultDataRegionConfiguration">
                    <bean
						class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="persistenceEnabled" value="true" />
                        
                        <property name="maxSize" value="${maxSize}" />
                        
                        <property name="checkpointPageBufferSize"
							value="${checkpointPageBufferSize}" />
                    </bean>
                </property>
                <property name="storagePath" value="${storagePath}" />
                <property name="walPath" value="${walPath}" />
                <property name="walArchivePath" value="${walArchivePath}" />
                <property name="walMode" value="LOG_ONLY" />
                <property name="pageSize" value="${pageSize}" />	
                
                <property name="writeThrottlingEnabled" value="true" />
            </bean>
        </property>
        <property name="discoverySpi">
            <bean
				class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
					
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <bean
class="org.springframework.util.StringUtils"
								factory-method="commaDelimitedListToSet">
                                <constructor-arg type="java.lang.String"
									value="${nodeIpAddresses}" />
                            </bean>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

End serve XML ===========================================

XML used for creating the cache where metric enabled flag is set at cache
level.


Begin ====================================
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
                          
http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/util
                          
http://www.springframework.org/schema/util/spring-util.xsd">
	
	 <bean id="placeholderConfig"
	
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="file:${PROPERTY_FILE_PATH}" />
	</bean> 
	<bean id="cache-template"
                class="org.apache.ignite.configuration.CacheConfiguration"
                abstract="true">
        <property name="name" value="EDIFCache*" />
        <property name="writeSynchronizationMode"
                        value="PRIMARY_SYNC " />
        <property name="affinity">
            <bean
                               
class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                <property name="excludeNeighbors" value="true" />
            </bean>
        </property>
    </bean>
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
		<property name="clientMode" value="true" />
		<property name="igniteInstanceName" value="EDIFCustomer-Client-Local" />
		<property name="metricsLogFrequency" value="0" />
		<property name="discoverySpi">
			<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
				<property name="ipFinder">
					<bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
						<property name="addresses">
							<bean class="org.springframework.util.StringUtils"
factory-method="commaDelimitedListToSet">
								<constructor-arg type="java.lang.String" value="${nodeIpAddresses}"
/>
							</bean>
						</property>
					</bean>
				</property>
			</bean>
		</property>
		<property name="cacheConfiguration">
            <list>
                <bean
class="org.apache.ignite.configuration.CacheConfiguration"
parent="cache-template">
                    <property name="name" value="CustomerCache" />
                    <property name="cacheMode" value="PARTITIONED" />
                    <property name="atomicityMode" value="ATOMIC" />
		    <property name="statisticsEnabled" value="true"/>
                    <property name="backups" value="1" />
                    <property name="queryEntities">
                        <list>
                            <bean
class="org.apache.ignite.cache.QueryEntity">
                                <property name="keyType"
value="java.lang.String" />
                                <property name="valueType"
value="com.jio.digitalapi.edif.customer.model.Customer" />
                                <property name="keyFieldName"
value="partyId" />
                                <property name="keyFields">
                                    <list>
                                        <value>partyId</value>
                                    </list>
                                </property>
                                <property name="fields">
                                    <map>
                                        <entry key="accountIdList"
value="java.lang.String" />
                                        <entry key="custAddressIdList"
value="java.lang.String" />
                                        <entry key="partyrole"
value="java.lang.String" />
                                        <entry key="partyStatusCode"
value="java.lang.String" />
                                    </map>
                                </property>
                                <property name="aliases">
                                    <map>
                                        <entry key="partyId"
value="PARTY_ID" />
                                        <entry key="accountIdList"
value="ACCOUNT_ID_LIST" />
                                        <entry key="custAddressIdList"
value="CUST_ADDRESS_ID_LIST" />
                                        <entry key="partyStatusCode"
value="PARTY_STATUS_CODE" />
                                    </map>
                                </property>
                            </bean>
                        </list>
                    </property>
                </bean>
                         </list>
                    </property>
                </bean>
            </list>
        </property>
	</bean>
</beans>

End  ====================================

Please let me know if you need anything further to reproduce the issue

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

I tested that it works. I attached my code for the server node and
configuration for the visor.

Could you please check it?

startActivate.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1704/startActivate.java>  
default-config.xml
<http://apache-ignite-users.70518.x6.nabble.com/file/t1704/default-config.xml>  

Run main class from startActivate.java and  visor cmd with provided config.
As a result I see:

visor> cache -c=cacheNam -a
Time of the snapshot: 2018-10-24 18:03:38
+============================================================================================================================+
|    Name(@)    |    Mode     | Nodes |   Entries (Heap / Off-heap)   |   
Hits     |  Misses   |    Reads    |    Writes    |
+============================================================================================================================+
| cacheNam(@c0) | PARTITIONED | 1     | min: 1000 (0 / 1000)          | min:
672    | min: 0    | min: 672    | min: 1000    |
|               |             |       | avg: 1000.00 (0.00 / 1000.00) | avg:
672.00 | avg: 0.00 | avg: 672.00 | avg: 1000.00 |
|               |             |       | max: 1000 (0 / 1000)          | max:
672    | max: 0    | max: 672    | max: 1000    |
+----------------------------------------------------------------------------------------------------------------------------+

Cache 'cacheNam(@c0)':
+-----------------------------------------------------+
| Name(@)                     | cacheNam(@c0)         |
| Nodes                       | 1                     |
| Total size Min/Avg/Max      | 1000 / 1000.00 / 1000 |
|   Heap size Min/Avg/Max     | 0 / 0.00 / 0          |
|   Off-heap size Min/Avg/Max | 1000 / 1000.00 / 1000 |
+-----------------------------------------------------+

Nodes for: cacheNam(@c0)
+============================================================================================================+
|     Node ID8(@), IP      | CPUs | Heap Used | CPU Load |   Up Time    |        
Size         | Hi/Mi/Rd/Wr |
+============================================================================================================+
| 543734D6(@n0), 10.0.75.1 | 4    | 1.89 %    | 0.00 %   | 00:11:32.856 |
Total: 1000          | Hi: 672     |
|                          |      |           |          |              |  
Heap: 0            | Mi: 0       |
|                          |      |           |          |              |  
Off-Heap: 1000     | Rd: 672     |
|                          |      |           |          |              |  
Off-Heap Memory: 0 | Wr: 1000    |
+------------------------------------------------------------------------------------------------------------+
'Hi' - Number of cache hits.
'Mi' - Number of cache misses.
'Rd' - number of cache reads.
'Wr' - Number of cache writes.

Aggregated queries metrics:
  Minimum execution time: 00:00:00.000
  Maximum execution time: 00:00:00.000
  Average execution time: 00:00:00.000
  Total number of executions: 0
  Total number of failures:   0

Please check it and if it will work then try to check your config (or attach
it as a XML file because you provide only part of it).

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by Naveen <na...@gmail.com>.
Hi Andrei 


This is how I am creating the cache
                <bean
class="org.apache.ignite.configuration.CacheConfiguration"
parent="cache-template">
                    <property name="name" value="CustomerCache" />
                    <property name="cacheMode" value="PARTITIONED" />
                    <property name="atomicityMode" value="ATOMIC" />
                     <property name="statisticsEnabled" value="true"/>
                     <property name="backups" value="1" />
                    <property name="queryEntities">



Here is node configuration, we read all the values from a properties file

                        
                        <property name="checkpointPageBufferSize"
                                                       
value="${checkpointPageBufferSize}" />
                    </bean>
                </property>
                <property name="storagePath" value="${storagePath}" />
                <property name="walPath" value="${walPath}" />
                <property name="walArchivePath" value="${walArchivePath}" />
                <property name="walMode" value="LOG_ONLY" />
                <property name="pageSize" value="${pageSize}" />
                
                <property name="writeThrottlingEnabled" value="true" />
                <property name="walHistorySize" value="1" />
            </bean>
        </property>
        <property name="discoverySpi">
            <bean
                               
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
                                               
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <bean
class="org.springframework.util.StringUtils"
                                                               
factory-method="commaDelimitedListToSet">
                                <constructor-arg type="java.lang.String"
                                                                       
value="${nodeIpAddresses}" />
                            </bean>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>




Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cache stats like number of cache hits, misses, reads, write, avg

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

Could you please provide the full configuration of the node?

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/