Re: query on BinaryObject index and table

2018-01-20 Thread Denis Magda


> On Jan 20, 2018, at 7:20 PM, Rajesh Kishore  wrote:
> 
> Hi,
> 
> I have requirement that my schema is not fixed , so I have to use the 
> BinaryObject approach instead of fixed POJO
> 
> I am relying on OOTB file system persistence mechanism
> 
> My questions are:
> - How can I specify the indexes on BinaryObject?

https://apacheignite-sql.readme.io/docs/create-index
https://apacheignite-sql.readme.io/docs/schema-and-indexes

> - If I have to use sql query for retrieving objects , what table name should 
> I specify, the one which is used for cache name does not work
> 

Was the table and its queryable fields/indexes created with CREATE TABLE or 
Java annotations/QueryEntity?

If the latter approach was taken then the table name corresponds to the Java 
type name as shown in this doc:
https://apacheignite-sql.readme.io/docs/schema-and-indexes

—
Denis

> -Rajesh



Re: AffinityKey - best practice

2018-01-20 Thread Denis Magda
Hi Raj,

Affinity collocation is an essential part of distributed caches and databases 
like Ignite that allows to store related data on the same cluster machine and, 
thus, making performance of particular operations much faster.

These resources will help you to grasp the idea and usefulness of this concept:
- 
https://www.gridgain.com/resources/blog/apache-cassandra-vs-apache-ignite-affinity-collocation-and-distributed-sql
- 
https://www.gridgain.com/resources/webinars/in-memory-computing-essentials-architects-and-developers-part-2
- 
https://www.gridgain.com/resources/webinars/scale-out-and-conquer-architectural-decisions-behind-distributed-in-memory

—
Denis

> On Jan 20, 2018, at 9:29 AM, Rajarshi Pain  wrote:
> 
> Hello,
> 
> I am trying to explore different functionality offered by Ignite (2.3) but 
> this AffinityKey concept is not quite clear to me so need some suggestion 
> from Ignite experts.
> 
> we are having a scenario where we will load all static data from DB to cache 
> and do various validations for the incoming messages. 
> 
> will AffinityKey  be useful in this scenario ? can we except better 
> performance that an implementation without AffinityKey ?
> 
> We will run a multi-node, multi-threaded application
> 
> -- 
> Regards,
> Raj



query on BinaryObject index and table

2018-01-20 Thread Rajesh Kishore
Hi,

I have requirement that my schema is not fixed , so I have to use the
BinaryObject approach instead of fixed POJO

I am relying on OOTB file system persistence mechanism

My questions are:
- How can I specify the indexes on BinaryObject?
- If I have to use sql query for retrieving objects , what table name
should I specify, the one which is used for cache name does not work

-Rajesh


Question about 'table' created by JDBC

2018-01-20 Thread mamaco
Hi,
I made a quick test to create a City table through DBeaver, and then I
accessed it through java app successfully.

But, when I loop the record, I found both of key and value were built by
BinaryObject with strange type.
Question 1: 
Is there any convenient API to get the type name from cache level?  
sth like this:
cache.getMetrics.getBinaryTypeName().
I'm just curious if JDBC operations could interact with JAVA api

Question 2: 
In JDBC is there any command like 'describe tablename' to query cache
structure?


public static void GetAll(IgniteCache cache)
{
Iterator>  itr =
cache.iterator();
while(itr.hasNext()){
Cache.Entry item = itr.next();
System.out.println("id="+item.getKey().field("id")+" 
KeyType="+item.getKey().type().typeName().toString());
System.out.println("CITY="+item.getValue().field("name")+ " 
ValueType="+item.getValue().type().typeName().toString());
}
}
-
id=1  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=Forest Hill 
ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
id=3  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=St. Petersburg 
ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
id=2  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
CITY=Denver  ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6


public static void Get(Ignite ignite, IgniteCache cache) {
Long keyValue = 3L;
BinaryObjectBuilder keyBuilder =
ignite.binary().builder("SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY")
.setField("id", keyValue);

BinaryObject value = cache.get(keyBuilder.build());
if(value!=null) System.out.println("CITY="+value.field("name"));
else System.out.println("Empty!!!");
}
-
CITY=St. Petersburg




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


Re: When is CacheStoreAdapter sessionEnd method called?

2018-01-20 Thread Pim D
How did you guys managed to get this working?
My sessionEnd is not called either (nor are write and delete).
Details:
http://apache-ignite-users.70518.x6.nabble.com/CacheStoreAdapter-write-and-delete-are-not-being-called-by-Ignite-s-GridCacheStoreManager-td19624.html



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


getAll Latency

2018-01-20 Thread rajivgandhi
Dear Ignite Community,
We have been using ignite for close to year now - in production since a
month. We use ignite as caching layer between the application (hosted in
AWS) and Dynamodb.

Below are the latency comparisions with DynamodB:
Ignite:
get: 800 microseconds
getAll (10 items): 8 milliseconds

DynamoDb:
get: 4 millseconds
getAll: 8 milliseconds

As you can see there is significant improvement for get operations. however,
the gain in getAll is not much.

Looking at Dynatrace, it seems Ignite getAll makes several calls to
GatewayProtectedCacheProxy.get api. Not familiar with ignite source code, it
seems like getAll is just a wrapped call to sequential get calls. so the
performance is obviously linear to n - no of items requested.

Can this not be more optimized with parallel calls to relevant nodes?
You could use non blocking IO in combination with light weight threads
(fibers eg. Quasar library). 
This way the performance will not be linear to n. 

thanks,
Rajeev





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


RE: CacheStoreAdapter not getting called on cache operation.

2018-01-20 Thread Pim D
Hi,

I'm experiencing the same problem (with write-behind set to false).
Were you able to identify the problem?

http://apache-ignite-users.70518.x6.nabble.com/CacheStore-example-for-partitioned-cache-backed-with-a-postgres-database-td19624.html

  



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


DataStreamer does not persist in cache when a receiver is set

2018-01-20 Thread Pim D
Hi,

I have created a datastreamer that will stream data from a database to my
cache.
This works very nice, untill...
... I include a StreamTransformer in the data streamer.
When the transformer is set, nothing gets stored in the cache?!?

In a simple example my transformer extends the StreamTransformer and
implements process:
@Override
public Object process(MutableEntry entry, Object...
arg) throws EntryProcessorException {
if (log.isDebugEnabled())
log.debug("Laad " + entry.getKey() + " in de cache");
if (arg.length==1 && arg[0] instanceof HighScore) {
// Transformeer stream argument naar het cache object en zet
deze
entry.setValue((Integer) arg[0]);
}
return arg[0];
}

Eventually I would really like to transform the object read from the
database to a new object which corresponds with my cache value object (basic
ETL).
But for now I first need to get the Streamer to work properly.
Any clues why this is not working?



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


AffinityKey - best practice

2018-01-20 Thread Rajarshi Pain
Hello,

I am trying to explore different functionality offered by Ignite (2.3) but
this AffinityKey concept is not quite clear to me so need some suggestion
from Ignite experts.

we are having a scenario where we will load all static data from DB to
cache and do various validations for the incoming messages.

will AffinityKey  be useful in this scenario ? can we except better
performance that an implementation without AffinityKey ?

We will run a multi-node, multi-threaded application

-- 
Regards,
Raj


CacheStore example for partitioned cache backed with a postgres database

2018-01-20 Thread Pim D
Hi,

I can't seem to find a good example on how to implement a CacheStoreAdapter
that also writes cache updates to a postgres database.

I've tried the standaard CacheJdbcStoreFactory, yet it does not write the
updates (even with read and write through set to true and WAL disabled).
I've created my own implementation of de CacheStoreAdapter and load(key) is
being called (and working), but Ignite does not call the write nor the
delete actions of the store.

I've been looking at the cassandra example, but that one is way more complex
and seems to require a lot more than I need (and thus adds even more
complexity).

Many thanks in advance,
Pim



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