You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Caio Nishibe <ca...@gmail.com> on 2016/09/01 19:21:51 UTC

Access cache entries in C++ via JNI call

Hi, I'm trying to implement a biometric identification system using Ignite.
The first version was not good enough because in my job, for each cache
entry, I was calling a C++ method through JNI to process that entry and the
time to transfer all the data from Java to C++ was killing the performance
of the threads. I've tried to create a C++ Client inside my Java job to run
a ScanQuery, but did not work and I discovered that I cannot create another
JVM instance inside a JNI call.  Is it possible to access all the cache
entries in C++ inside a JNI call?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Access-cache-entries-in-C-via-JNI-call-tp7462.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Access cache entries in C++ via JNI call

Posted by Igor Sapego <is...@gridgain.com>.
Hi Caio,

I don't think it's possible currently. We have plans on introducing
Compute functionality into C++ client, but it is not there yet and
you can't access cache entities from the JNI using public API.

Best Regards,
Igor

On Fri, Sep 2, 2016 at 2:04 PM, Caio Nishibe <ca...@gmail.com> wrote:

> Hi Igor,
>
> my cluster has 34 server nodes and 1 client node. Biometric data
> (fingerprint templates) is spread across a distributed cache (about 50
> million fingerprint templates). The client node creates an identification
> task, which has to compare an input fingerprint against all stored
> templates. This task creates one job per cluster node, so each node
> performs
> comparisons against its local cache entries.
>
> The comparison algorithm is written in C++, so for this reason I need to
> call a JNI method for each entry comparison, transfering the templates from
> Java Ignite cache to my C++ dll. This is time consuming and not performed
> well.
>
> What I'm trying to do is to emulate a C++ Compute Grid capability. I'm
> asking if it's possible to create a Java job, which calls my C++ dll
> through JNI and the dll access directly the Ignite cache to perform the
> comparisons, eliminating the transfer time. I know that the C++ client
> could
> access the cache using a ScanQuery, but I was not able to instantiate a C++
> client inside my Java job since, as far as I know, It's not possible to
> instantiate a new JVM inside a JNI call.
>
> Best Regards,
>
> Caio
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Access-cache-entries-in-C-via-JNI-
> call-tp7462p7478.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Access cache entries in C++ via JNI call

Posted by Caio Nishibe <ca...@gmail.com>.
Hi Igor,

my cluster has 34 server nodes and 1 client node. Biometric data
(fingerprint templates) is spread across a distributed cache (about 50
million fingerprint templates). The client node creates an identification
task, which has to compare an input fingerprint against all stored
templates. This task creates one job per cluster node, so each node performs
comparisons against its local cache entries. 

The comparison algorithm is written in C++, so for this reason I need to
call a JNI method for each entry comparison, transfering the templates from
Java Ignite cache to my C++ dll. This is time consuming and not performed
well.

What I'm trying to do is to emulate a C++ Compute Grid capability. I'm
asking if it's possible to create a Java job, which calls my C++ dll 
through JNI and the dll access directly the Ignite cache to perform the
comparisons, eliminating the transfer time. I know that the C++ client could
access the cache using a ScanQuery, but I was not able to instantiate a C++
client inside my Java job since, as far as I know, It's not possible to
instantiate a new JVM inside a JNI call.

Best Regards,

Caio



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Access-cache-entries-in-C-via-JNI-call-tp7462p7478.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Access cache entries in C++ via JNI call

Posted by Igor Sapego <is...@gridgain.com>.
Hi,

You can try using Ignite C++ client. If you describe your use-case some
more I'll be able to provide you with some more specific advice.

What for are you using Ignite for and why do you need to make JNI calls?


Best Regards,
Igor

On Thu, Sep 1, 2016 at 10:21 PM, Caio Nishibe <ca...@gmail.com> wrote:

> Hi, I'm trying to implement a biometric identification system using Ignite.
> The first version was not good enough because in my job, for each cache
> entry, I was calling a C++ method through JNI to process that entry and the
> time to transfer all the data from Java to C++ was killing the performance
> of the threads. I've tried to create a C++ Client inside my Java job to run
> a ScanQuery, but did not work and I discovered that I cannot create another
> JVM instance inside a JNI call.  Is it possible to access all the cache
> entries in C++ inside a JNI call?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Access-cache-entries-in-C-via-JNI-call-tp7462.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>