You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by adipro <ad...@zohocorp.com> on 2020/06/03 07:54:14 UTC

Question regarding topology

If I have a cache named "XYZ" with replication mode ON then what happens for
the queries if the topology configuration is as below.

1) Two app servers (clients) which make total 100 connections (50 each) in
parallel as it's multi-threaded application. Both are 64 core machines.
2) Two DB servers (servers) which has both 32 cores each.

Since the cache is in replication mode, the queries can be made to either of
the server and no need for querying other DB server. So in client side, we
have IP list which contains IPs of both those servers.

For this above configuration we are getting constant thread starvation
warnings. But if we decrease number of parallel connections to DB to about
40-50, then no issues/warnings are arising.

We have a few questions about this.

1) How Ignite client node knows which DB server node it has to connect? Or
will it always connect to coordinator node?
2) We enabled 100 parallel thread pool connections in DB servers but still
warnings are coming because app servers will, since it's has less cores, is
this the reason for those thread starvations? If so, if we add one more
server node will it resolve the issue?
3) If we get a requirement to make 200-500 connections in parallel in future
to DB then what is the configuration we need to set for DB nodes. Should we
keep increasing server nodes to the topology(asking for XYZ cache)?



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

Re: Question regarding topology

Posted by Alexandr Shapkin <le...@gmail.com>.
Hello!

It's not clear, whether the code snippet came from a client or a server. If
it's a client, then I'd recommend you try sending the keys and additional
data directly to a server node and perform the insertion directly on the
node. The Compute API could be an option here [1]

You might also want to check the thread dump or JFR and check where the
possible starvation is happening. It's also useful to check the resource
utilization prior to adding additional nodes.

[1] - https://apacheignite.readme.io/docs/compute-grid#ignitecompute



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

Re: Question regarding topology

Posted by adipro <ad...@zohocorp.com>.
Can someone please help with this case?



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

Re: Question regarding topology

Posted by adipro <ad...@zohocorp.com>.
Also,

In SQL query, we are having a semaphore lock where all the threads stay
there and only one thread can execute the code. It's because in the code, we
have jdbc connection query. And it's not thread safe. Sometimes we even get
thread hanging here if we keep increasing client worker threads. Is there
any alternative for this? We need streaming ON, otherwise we can using
SQLFieldsQuery but it's taking time as we need to do one by one.



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

Re: Question regarding topology

Posted by adipro <ad...@zohocorp.com>.
Thanks for reply.

Our clients are connected in both ways one is JCache way and other is SQL
way each for various caches.

-> For get/put we use normal getAll() and normal putAll(). The thing is here
all the threads will have their own data and the data is not shared. So no
need to worry about data consistency here.

-> For SQL, we are using java thin client. I'll share a sample code on how
we are doing it. Please check below code.
 
```
IgniteSemaphore semaphore = null;
                    try {
                        semaphore =
cacheHolder.getJDBCSemaphore(IgniteLocks.JDBC_LOCK.getLockValue());
                        semaphore.acquire();
                        try{
                           
Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
                        }
                        catch(Exception e) {
                            e.printStackTrace();
                        }
                        try(final Connection conn =
DriverManager.getConnection(IgniteCacheTable.JDBC_THIN_URL_STRING.toString())){
                            try (final Statement stmt =
conn.createStatement()) {
                                stmt.executeUpdate("SET STREAMING ON
ALLOW_OVERWRITE ON");//No I18N
                            }
                            try(final PreparedStatement stmt =
conn.prepareStatement(
                                    "INSERT INTO URLS VALUES (?, ?, ?, ?)"))
{//No I18N
                                while (keys.hasNext()) {
                                    String key = keys.next().toString();
                                    s_id = cacheHolder.getAtomicSequence();
                                    stmt.setLong(1, s_id);
                                    stmt.setString(2, key);
                                    stmt.setDouble(3,
Double.parseDouble(keyValueMap.get(key).toString()));
                                    stmt.setLong(4, appNameId);
                                    stmt.execute();
                                   
appNameUrl.put(IgniteCacheTable.FRONTIER_DB.getDBValue()+"|"+objects[1]+"|"+key,
s_id);
                                }
                            }
                        }
                    }
                    finally {
                        if(semaphore != null){
                            semaphore.release();
                        }
                    }
```


All these queries will be made simultaneously within the App servers.



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

Re: Question regarding topology

Posted by Stephen Darlington <st...@gridgain.com>.
How are your clients connected? Are they thick or thin clients? And what are the queries? Are they JCache (i.e., get/put) or SQL?

> On 3 Jun 2020, at 08:54, adipro <ad...@zohocorp.com> wrote:
> 
> If I have a cache named "XYZ" with replication mode ON then what happens for
> the queries if the topology configuration is as below.
> 
> 1) Two app servers (clients) which make total 100 connections (50 each) in
> parallel as it's multi-threaded application. Both are 64 core machines.
> 2) Two DB servers (servers) which has both 32 cores each.
> 
> Since the cache is in replication mode, the queries can be made to either of
> the server and no need for querying other DB server. So in client side, we
> have IP list which contains IPs of both those servers.
> 
> For this above configuration we are getting constant thread starvation
> warnings. But if we decrease number of parallel connections to DB to about
> 40-50, then no issues/warnings are arising.
> 
> We have a few questions about this.
> 
> 1) How Ignite client node knows which DB server node it has to connect? Or
> will it always connect to coordinator node?
> 2) We enabled 100 parallel thread pool connections in DB servers but still
> warnings are coming because app servers will, since it's has less cores, is
> this the reason for those thread starvations? If so, if we add one more
> server node will it resolve the issue?
> 3) If we get a requirement to make 200-500 connections in parallel in future
> to DB then what is the configuration we need to set for DB nodes. Should we
> keep increasing server nodes to the topology(asking for XYZ cache)?
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/