Barry,

Thanks a lot for the explanation. This leads me to ask yet another question. If 
calling get with either client (gfsh, java) pursues the same objective, why do 
they call different methods? Isn't that the source of this bug (having two 
implementations of the same thing)?

Alberto

On 22/5/19 23:32, Barry Oglesby wrote:
Alberto,

There is a lot of good discussion in that JIRA, but to answer your question 
about the difference between using gfsh and client:

The gfsh command uses the DataCommandFunction.

DataCommandFunction.get uses the public API get method which ends up in this 
PartitionedRegion.get method:

  public Object get(Object key, Object aCallbackArgument, boolean 
generateCallbacks,
      boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID 
requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones)
      throws TimeoutException, CacheLoaderException;

This method does not call endGet on the PartitionedRegion.

The client Get70.cmdExecute method calls LocalRegion.getRetained which ends up 
in this LocalRegion.get method:

  Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
      boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID 
requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones, boolean 
opScopeIsLocal,
      boolean retainResult) throws TimeoutException, CacheLoaderException;

This method does call endGet on the PartitionedRegion. In the meantime, it does 
the same thing as the above method with the BucketRegion.

Thanks,
Barry Oglesby



On Tue, May 21, 2019 at 11:57 PM Alberto Gomez 
<[email protected]><mailto:[email protected]> wrote:
Barry,

Thanks a lot for the hint.

As you figured out, I was getting the hitCount and missCount from the members.

I still do not understand why the path (the calls in the servers code) to get 
the data from the cluster is different when you get the entry with gfsh than 
when you get it with the Java API.

The fact is that the sequence of Java calls in the cluster when you use the 
Java API leads to CachePerfStats.endGet being called twice, either because it 
is called twice from LocalRegion or once from LocalRegion and another one from 
BucketRegion.

I just found out that this issue is being investigated in the following ticket:
https://issues.apache.org/jira/browse/GEODE-6472

Best regards,

Alberto


On 18/5/19 3:26, Barry Oglesby wrote:
Alberto,

I wanted to verify where you are getting the hitCount and missCount from in 
your test.

If you are using show metrics, then the region hitCount and missCount are both 
-1 for partitioned regions. The RegionMBean doesn't support these values for 
partitioned regions.

gfsh>show metrics --region=/overload
Cluster-wide Region Metrics

Category  |            Metric            | Value
--------- | ---------------------------- | -----
...
region    | missCount                    | -1
          | hitCount                     | -1

The totalHitCount and totalMissCount are supported for the member, though.

If thats what you are using, then I see the same behavior.

show metrics before a non-miss get:

Category  |        Metric         | Value
--------- | --------------------- | -----
cache     | totalMissCount        | 0
          | totalHitCount         | 17

show metrics after a non-miss get:

Category  |        Metric         | Value
--------- | --------------------- | -----
cluster   | totalMissCount        | 1
          | totalHitCount         | 18

That shows 1 hit and 1 miss on a single non-miss get.

Those values come from the MemberMBean getTotalHitCount and getTotalMissCount.

Those in turn come from CachePerfStats gets and misses. The TotalHitCount is 
gets-misses and the TotalMissCount is misses.

If I add logging to CachePerfStats.endGet (where those stats are incremented), 
I see it is called twice for the single get from a client - once for the 
PartitionedRegion and once for the BucketRegion.

The misses is incremented for the PartitionedRegion. So, misses is incremented 
when it shouldn't be.

For gfsh, I only see CachePerfStats.endGet called one - for the BucketRegion. 
This does not increment the misses.

Thanks,
Barry Oglesby



On Fri, May 17, 2019 at 4:23 PM Alberto Gomez 
<[email protected]><mailto:[email protected]> wrote:
Hi,

I do not yet have an automatic test but this is the client code I am using:

package org.apache.geode_examples.overload;

import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.pdx.ReflectionBasedAutoSerializer;

public class SimpleClient {

  public static void main(String[] args) {

    ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 
10334)
        .setPoolReadTimeout(10).setPoolRetryAttempts(1)
        .setPdxSerializer(new 
ReflectionBasedAutoSerializer("org.apache.geode_examples.overload.*"))
        .set("log-level", "WARN").create();

    Region region = 
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("overload");

    region.get(args[0]);
    cache.close();
  }
}

Thanks,

/Alberto

On 17/5/19 17:59, pulkit chandra wrote:
Best to share the test case code with the community.

Pulkit Chandra
412-641-9176


On Fri, May 17, 2019 at 11:37 AM Anthony Baker 
<[email protected]<mailto:[email protected]>> wrote:
What’s the redundancy and how many members are in the cluster?  Are you using 
single-hop?

Thanks,
Anthony


On May 17, 2019, at 12:15 AM, Alberto Gomez 
<[email protected]<mailto:[email protected]>> wrote:


Hi Geode community,

Running some queries on a partitioned region I have noticed some behavior for 
the hitCount and missCount counters that does not look right to me:

If I retrieve an entry present in the region from gfsh using get, the 
hitCounter is incremented once and the missCounter is not incremented.

But, if I run the same get from a java client (using 
ClientRegionShortcut.PROXY), what I see is that the hitCount is incremented 
once but also the missCount is incremented once. The hitCount is always 
incremented on the server hosting the bucket where the entry is stored while 
the missCount, sometimes is incremented on that same server while others it is 
incremented on the server not hosting the bucket.

Is this a bug in Geode or could there an explanation for the different behavior 
depending on the client?

Thanks in advance,

/Alberto




Reply via email to