You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Rahul.S" <ra...@tayana.in> on 2017/06/20 12:35:01 UTC

How to compile C++ code..

Hi Ignite Team,
I am intended to compile the c++ code that i have written (its is pretty
much copy from the example of put-get with slight modifications..).
I went through the "DEVNOTE.txt" in the "$IGNITE_HOME/platforms/cpp/".
Completed all the steps as mentioned there (including "make install" as
root).
I can see the libraries and the includes in the "/usr/local/lib/" directory.
There i found a hint as using flag "-lignite" in the g++ command to will
include all the dependency for ignite.

but i am getting an error for which i tried my best to but finally failed to
resolve it, so requesting you people to help me in this. 

Here is the command that i am using to compile the c code that is in home
directory:

g++ -I /usr/java/jdk1.8.0_131/include/ -I
/usr/java/jdk1.8.0_131/include/linux/ -I
$IGNITE_HOME/platforms/cpp/jni/include/ -I
$IGNITE_HOME/platforms/cpp/core/include/ -I
$IGNITE_HOME/platforms/cpp/common/os/linux/include/ -I
$IGNITE_HOME/platforms/cpp/examples/include/ DataGridTest.cc -o DataGridTest
-ldl /usr/bin/ld /usr/local/lib/libignite.so -lignite

for the above which i am getting an error as :

/usr/bin/ld: /tmp/cciurNhQ.o: undefined reference to symbol
'_ZN6ignite3jni4java12JniErrorInfoD1Ev'
/usr/local/lib//libignite-jni-2.0.0.19668.so.0: error adding symbols: DSO
missing from command line
collect2: error: ld returned 1 exit status


Thanks in advance.....



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
Can you start a new thread, where you mention performance
issues in the caption? No one except for me never is going
to read mails with caption asking "How to compile C++ code" :)

Best Regards,
Igor

On Wed, Jun 28, 2017 at 6:35 AM, Rahul.S <ra...@tayana.in> wrote:

> Here my major considerations is High Data availability across all the nodes
> that are participating in the cluster and every thing must be in full sync.
>
> my idea was to increase the operations so i though of increasing the thread
> pool which i have increased to 100 but still by using the command "ps -efL
> |
> grep <Process name> | wc -l" i am getting the max threads are 64.....
>
> there i have used binary configurations to have the platform
> interoperability.
>
> <?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="grid.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>         <property name="peerClassLoadingEnabled" value="true"/>
>
>                         <property name="systemThreadPoolSize" value="100"/>
>
>
> <property name="binaryConfiguration">
>             <bean
> class="org.apache.ignite.configuration.BinaryConfiguration">
>                 <property name="compactFooter" value="false"/>
>
>                 <property name="idMapper">
>                     <bean
> class="org.apache.ignite.binary.BinaryBasicIdMapper">
>                         <property name="lowerCase" value="true"/>
>                     </bean>
>                 </property>
>
>                 <property name="nameMapper">
>                     <bean
> class="org.apache.ignite.binary.BinaryBasicNameMapper">
>                         <property name="simpleName" value="true"/>
>                     </bean>
>                 </property>
>
>                 <property name="classNames">
>                     <list>
>                         <value>org.apache.ignite.
> examples.CrossClass</value>
>                     </list>
>                 </property>
>             </bean>
>         </property>
>
>
>         <property name="cacheConfiguration">
>             <list>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                                                         <property
> name="name" value="txnCache"/>
>                                                         <property
> name="cacheMode" value="PARTITIONED"/>
>                                                         <property
> name="writeSynchronizationMode" value="FULL_SYNC"/>
>                                                         <property
> name="backups" value="1"/>
>                 </bean>
>             </list>
>         </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">
>                             <list>
>
>
>                                 <value>10.0.2.55:47500..47510</value>
>                                 <value>10.0.2.56:47500..47510</value>
>                                 <value>10.0.2.57:47500..47510</value>
>                             </list>
>                         </property>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>     </bean>
> </beans>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14124.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
Here my major considerations is High Data availability across all the nodes
that are participating in the cluster and every thing must be in full sync.

my idea was to increase the operations so i though of increasing the thread
pool which i have increased to 100 but still by using the command "ps -efL |
grep <Process name> | wc -l" i am getting the max threads are 64.....

there i have used binary configurations to have the platform
interoperability.

<?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="grid.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        
        <property name="peerClassLoadingEnabled" value="true"/>
                        
                        <property name="systemThreadPoolSize" value="100"/>


<property name="binaryConfiguration">
            <bean
class="org.apache.ignite.configuration.BinaryConfiguration">
                <property name="compactFooter" value="false"/>

                <property name="idMapper">
                    <bean
class="org.apache.ignite.binary.BinaryBasicIdMapper">
                        <property name="lowerCase" value="true"/>
                    </bean>
                </property>

                <property name="nameMapper">
                    <bean
class="org.apache.ignite.binary.BinaryBasicNameMapper">
                        <property name="simpleName" value="true"/>
                    </bean>
                </property>

                <property name="classNames">
                    <list>
                        <value>org.apache.ignite.examples.CrossClass</value>
                    </list>
                </property>
            </bean>
        </property>


        <property name="cacheConfiguration">
            <list>
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                                                        <property
name="name" value="txnCache"/>
                                                        <property
name="cacheMode" value="PARTITIONED"/>
                                                        <property
name="writeSynchronizationMode" value="FULL_SYNC"/>
                                                        <property
name="backups" value="1"/>
                </bean>
            </list>
        </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">
                            <list>
                                
                                
                                <value>10.0.2.55:47500..47510</value>
                                <value>10.0.2.56:47500..47510</value>
                                <value>10.0.2.57:47500..47510</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14124.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
Can you also share your configuration file?

By the way, using double as a key type seems to be a *really*
bad idea. It should not affect performance, but may cause
a lot of issues.

Best Regards,
Igor

On Tue, Jun 27, 2017 at 4:46 PM, Rahul.S <ra...@tayana.in> wrote:

> this is the function that performs the insert and delete operations
> spontaneously and every second it will put a console message about the
> amount of operations in that second ........
>
> if run as stand alone(10.0.2.55 application node) with only one node up i
> get about 70,000 operations per second, mean while it is running if start
> another node in just ignite with the configurations (10.0.2.56) then the
> transactions rate will drop to max of 7000(at the starting it will be very
> less, i understand that is because of data balancing between the nodes.),
>
> void put(Cache<double , double>& cache, int lTime, vector<double>  &Stat,
> key_t mQueId)
> {
>
>         double counter = 0;
>         double lTotalInsertionsCount = 0;
>         double lStartime = time(NULL);
>
>         while(lStartime == time(NULL));
>         double lEndTime = time(NULL) + lTime;
>         double lCurrentSec = time(NULL);
>         double looptime;
>         double lDeleteCounter = 0;
>         double lDeleteStartCounter = 0;
>
>         if (lEvenFlag  != 1)
>         {
>                 lTotalInsertionsCount = 1;
>                 lDeleteStartCounter = 1;
>         }
>
>         while(lEndTime > time(NULL))
>         {
>                 if((lCurrentSec + 1) == (looptime = time(NULL)))
>                 {
>                         lCurrentSec = time(NULL);
>                         //                      Stat.push_back(counter);
>                         //                      cout << "Time : " <<
> time(NULL) << ", Cache size : " << cache.LocalSize() << ", Contents Wrote :
> " << counter << endl;
>                         cout << "Time : "<< looptime << "No Of Records " <<
> counter << endl;
>                         counter = 0;
>                 }
>
>                 cache.Put(lTotalInsertionsCount,counter++);
>
>                 if ( 0 != msgsnd (mQueId, &lTotalInsertionsCount,
> sizeof(lTotalInsertionsCount), IPC_NOWAIT))
>                 {
>                         cout << "Que write FAILED!!!! for : " <<
> lTotalInsertionsCount << endl;
>                 }
>
>                 lTotalInsertionsCount+=2;
>                 lDeleteCounter++;
>                 if (lDeleteCounter > 50000)
>                 {
>                         cache.Remove(lDeleteStartCounter);
>                         lDeleteStartCounter+=2;
>                         counter++;
>                 }
>         }
>         cout << endl;
>         cout << "**************************************" << endl;
>         //       cout << "-> No of records : " << counter << " for given "
> << lTime << " seconds inserted." << endl;
>         cout << "-> Total No of insertions : " << lTotalInsertionsCount/2
> <<
> endl;
>         cout << "**************************************" << endl;
>         cout << endl;
> }
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14115.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
this is the function that performs the insert and delete operations
spontaneously and every second it will put a console message about the
amount of operations in that second ........

if run as stand alone(10.0.2.55 application node) with only one node up i
get about 70,000 operations per second, mean while it is running if start
another node in just ignite with the configurations (10.0.2.56) then the
transactions rate will drop to max of 7000(at the starting it will be very
less, i understand that is because of data balancing between the nodes.),

void put(Cache<double , double>& cache, int lTime, vector<double>  &Stat,
key_t mQueId)
{

        double counter = 0;
        double lTotalInsertionsCount = 0;
        double lStartime = time(NULL);

        while(lStartime == time(NULL));
        double lEndTime = time(NULL) + lTime;
        double lCurrentSec = time(NULL);
        double looptime;
        double lDeleteCounter = 0;
        double lDeleteStartCounter = 0;

        if (lEvenFlag  != 1)
        {
                lTotalInsertionsCount = 1;
                lDeleteStartCounter = 1;
        }

        while(lEndTime > time(NULL))
        {
                if((lCurrentSec + 1) == (looptime = time(NULL)))
                {
                        lCurrentSec = time(NULL);
                        //                      Stat.push_back(counter);
                        //                      cout << "Time : " <<
time(NULL) << ", Cache size : " << cache.LocalSize() << ", Contents Wrote :
" << counter << endl;
                        cout << "Time : "<< looptime << "No Of Records " <<
counter << endl;
                        counter = 0;
                }

                cache.Put(lTotalInsertionsCount,counter++);

                if ( 0 != msgsnd (mQueId, &lTotalInsertionsCount,
sizeof(lTotalInsertionsCount), IPC_NOWAIT))
                {
                        cout << "Que write FAILED!!!! for : " <<
lTotalInsertionsCount << endl;
                }

                lTotalInsertionsCount+=2;
                lDeleteCounter++;
                if (lDeleteCounter > 50000)
                {
                        cache.Remove(lDeleteStartCounter);
                        lDeleteStartCounter+=2;
                        counter++;
                }
        }
        cout << endl;
        cout << "**************************************" << endl;
        //       cout << "-> No of records : " << counter << " for given "
<< lTime << " seconds inserted." << endl;
        cout << "-> Total No of insertions : " << lTotalInsertionsCount/2 <<
endl;
        cout << "**************************************" << endl;
        cout << endl;
}




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14115.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
Some short runnable code that shows the problem.

Best Regards,
Igor

On Tue, Jun 27, 2017 at 4:10 PM, Rahul.S <ra...@tayana.in> wrote:

> Sorry i didn't got "reproducer",...
> what is it specifically......
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14111.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
Sorry i didn't got "reproducer",...
what is it specifically......



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14111.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
It should definitely work faster then.
Can you share reproducer so we can find out what is the issue?


Best Regards,
Igor

On Tue, Jun 27, 2017 at 3:19 PM, Rahul.S <ra...@tayana.in> wrote:

> Here i am not using the SQL quires, I am just doing the cache put/get
> operations..
> though its in memory i expect it to be fast then the RDBMS what we are
> actually using till now.....
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14105.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
Here i am not using the SQL quires, I am just doing the cache put/get
operations..
though its in memory i expect it to be fast then the RDBMS what we are
actually using till now.....



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14105.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
Well, if you perform DML operations with single row by query,
then the reason may be a network round trip - for every
operation you need to send packet and receive response, which
may cause network delay.

Best Regards,
Igor

On Tue, Jun 27, 2017 at 3:10 PM, Rahul.S <ra...@tayana.in> wrote:

> Ignite 2.0
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14103.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
Ignite 2.0



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14103.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

Posted by Igor Sapego <is...@gridgain.com>.
Which Ignite version do you use and what kind of operations
do you perform?

Best Regards,
Igor

On Tue, Jun 27, 2017 at 10:10 AM, Rahul.S <ra...@tayana.in> wrote:

> Thank you!
> It worked.......
>
> but still had some queries, i am inserting the data of type
> "double"(including both key and value), i am inserting and deleting the
> contents spontaneously and at every second i am printing the total number
> of
> operations that is taking place.
> what i can see at that point is that the max transactions that are taking
> place per second are around 6000.
> the data is of 64 bit wide (for double), my doubt here is that though we
> are
> working in in-memory  why is it so slow??. and i have started another node
> as stand alone here, with same configurations.....
> if i run the same with only one node then my transaction rate will around
> 70,000.....
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989p14091.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: How to compile C++ code..

Posted by "Rahul.S" <ra...@tayana.in>.
Thank you!
It worked.......

but still had some queries, i am inserting the data of type
"double"(including both key and value), i am inserting and deleting the
contents spontaneously and at every second i am printing the total number of
operations that is taking place.
what i can see at that point is that the max transactions that are taking
place per second are around 6000.
the data is of 64 bit wide (for double), my doubt here is that though we are
working in in-memory  why is it so slow??. and i have started another node
as stand alone here, with same configurations.....
if i run the same with only one node then my transaction rate will around
70,000.....




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-compile-C-code-tp13989p14091.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How to compile C++ code..

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

You need to exclude "/usr/bin/ld /usr/local/lib/libignite.so" part and add
-lignite-jni -lignite-binary
-lignite-common -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm

Best Regards,
Igor

On Tue, Jun 20, 2017 at 3:35 PM, Rahul.S <ra...@tayana.in> wrote:

> Hi Ignite Team,
> I am intended to compile the c++ code that i have written (its is pretty
> much copy from the example of put-get with slight modifications..).
> I went through the "DEVNOTE.txt" in the "$IGNITE_HOME/platforms/cpp/".
> Completed all the steps as mentioned there (including "make install" as
> root).
> I can see the libraries and the includes in the "/usr/local/lib/"
> directory.
> There i found a hint as using flag "-lignite" in the g++ command to will
> include all the dependency for ignite.
>
> but i am getting an error for which i tried my best to but finally failed
> to
> resolve it, so requesting you people to help me in this.
>
> Here is the command that i am using to compile the c code that is in home
> directory:
>
> g++ -I /usr/java/jdk1.8.0_131/include/ -I
> /usr/java/jdk1.8.0_131/include/linux/ -I
> $IGNITE_HOME/platforms/cpp/jni/include/ -I
> $IGNITE_HOME/platforms/cpp/core/include/ -I
> $IGNITE_HOME/platforms/cpp/common/os/linux/include/ -I
> $IGNITE_HOME/platforms/cpp/examples/include/ DataGridTest.cc -o
> DataGridTest
> -ldl /usr/bin/ld /usr/local/lib/libignite.so -lignite
>
> for the above which i am getting an error as :
>
> /usr/bin/ld: /tmp/cciurNhQ.o: undefined reference to symbol
> '_ZN6ignite3jni4java12JniErrorInfoD1Ev'
> /usr/local/lib//libignite-jni-2.0.0.19668.so.0: error adding symbols: DSO
> missing from command line
> collect2: error: ld returned 1 exit status
>
>
> Thanks in advance.....
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-compile-C-code-tp13989.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>