You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by smovva <su...@sturfee.com> on 2018/06/29 21:08:39 UTC
OutOfMemoryError while streaming
I'm seeing OutOfMemoryError when I have multiple data streamers pushing data
into the cluster.
My cluster consists of 8 servers running one node each. Each server has 32GB
RAM and 4 Cores.
All the nodes are started like this
=================
bin/ignite.sh -J-Xmx3g config/dev-cluster-config.xml
=================
My cache consists of
- key: strings of length 9 chars
- Value: POJOs that have some metadata and one large array of integers
(8800 values)
I have 4 data streamers and as they start pushing data, I see some server
nodes throwing OutOfMemoryErrors and the data streamers hangup.
The streamer code is here.
==========================================
CacheConfiguration<String, Tile> cacheCfg = new
CacheConfiguration<>(DATA_CACHE_NAME);
cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cacheCfg.setCacheMode(CacheMode.PARTITIONED);
cacheCfg.setBackups(2);
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setIndexedTypes(String.class, Tile.class);
IgniteCache<String, Tile> viewpointCache =
ignite.getOrCreateCache(cacheCfg);
try (IgniteDataStreamer<String, Tile> streamer =
ignite.dataStreamer(viewpointCache.getName())) {
Path sourceFile = Paths.get(hashIndexFile);
try(BufferedReader reader = Files.newBufferedReader(sourceFile,
Charset.forName("UTF-8")))
{
String currentLine = null;
while((currentLine = reader.readLine()) != null){
String hash = currentLine.trim();
streamer.addData(hash, getTileFor(hash));
}
}
}
==========================================
Cluster-config.xml
<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="igniteInstanceName"
value="dev-ignite-cluster-us-east1"/>
<property name="peerClassLoadingEnabled" value="true"/>
<property name="dataStorageConfiguration">
<bean
class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
<property name="maxSize" value="#{16L * 1024 * 1024
* 1024}"/>
</bean>
</property>
</bean>
</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.s3.TcpDiscoveryS3IpFinder">
<!-- Aws config goes here-- >
</bean>
</property>
</bean>
</property>
</bean>
=========================================
Also, I noticed that there is nothing in off-heap memory. Here is the cache
stats for one node.
Total: 513278
Heap: 5
Off-Heap: 513273
Off-Heap Memory: 0
and config also shows
| Non-heap memory initialized | 2mb
| Non-heap memory used | 86mb
| Non-heap memory committed | 88mb
| Non-heap memory maximum | 744mb
How do I make it use and store more in Non-heap memory?
Thanks!
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: OutOfMemoryError while streaming
Posted by Denis Mekhanikov <dm...@gmail.com>.
How many entries did you put into a cache?
How do you check, that nodes have entries?
Did you configure a node filter for the cache?
Rendezvous affinity function may give unfair distribution on small
datasets,
but it gets better, when number of entries grows.
So, if you've only put 5-10 entries, then you may get unfair data
distribution.
Denis
вс, 1 июл. 2018 г. в 18:33, breischl <br...@gmail.com>:
> The keys are hashed so in theory they should be distributed relatively
> evenly. I traced the logic to do the hashing once and it seemed ok, but
> it's
> pretty complicated so I won't claim to know it that well. We use UUIDs and
> it does seem to distribute pretty much evenly.
>
> Are you sure all the nodes have properly joined the cluster? ie, that you
> have a single cluster with 8 nodes, instead of a bunch of 1-2 node
> clusters.
> Depending on how your discovery is set up, that can be tricky and
> potentially have timing bugs. Although that may be more due to us having a
> custom DiscoverySPI that is a bit finicky.
>
> For #2, I would like to know the answer too. :) We are using
> OptimizedMarshaller, but that's due to some problems with serializing some
> of our complex objects which would not apply to your case. You may want to
> just test it.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: OutOfMemoryError while streaming
Posted by breischl <br...@gmail.com>.
The keys are hashed so in theory they should be distributed relatively
evenly. I traced the logic to do the hashing once and it seemed ok, but it's
pretty complicated so I won't claim to know it that well. We use UUIDs and
it does seem to distribute pretty much evenly.
Are you sure all the nodes have properly joined the cluster? ie, that you
have a single cluster with 8 nodes, instead of a bunch of 1-2 node clusters.
Depending on how your discovery is set up, that can be tricky and
potentially have timing bugs. Although that may be more due to us having a
custom DiscoverySPI that is a bit finicky.
For #2, I would like to know the answer too. :) We are using
OptimizedMarshaller, but that's due to some problems with serializing some
of our complex objects which would not apply to your case. You may want to
just test it.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: OutOfMemoryError while streaming
Posted by smovva <su...@sturfee.com>.
Thanks again.
I have one more question. After pushing some data, I see only two nodes
having entries out of 8. All the others have 0 entries.
My keys are 9 char long strings with a common prefix (all have the same
first 3 chars). Wondering why the keys are not evenly distributed.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: OutOfMemoryError while streaming
Posted by breischl <br...@gmail.com>.
Non-heap memory is different than off-heap memory. Non-heap is (roughly
speaking) memory that the JVM itself uses. Off-heap is what Ignite is using
for storage off the heap. So you're probably not looking at what you think
you're looking at.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: OutOfMemoryError while streaming
Posted by smovva <su...@sturfee.com>.
breischl, Thanks for the quick response.
I'm not sure why the node stats show
========================
Non-heap memory maximum | 744mb
========================
Each server node has 32GB and I've assigned 3g for heap. Shouldn't this be
16GB since that's what I set the data region size to?
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: OutOfMemoryError while streaming
Posted by breischl <br...@gmail.com>.
You're probably just running out of memory, though if you examine the
stacktrace it may tell you if you're running out of heap or off-heap memory.
If there's a call to Unsafe.something() in there, it's probably off-heap.
Otherwise it's probably on-heap.
You do seem to be configuring only a 3 GB heap, and 16 GB off off-heap, so
you're likely not utilizing all the available memory.
I believe you have to explicitly enable off-heap metrics collection, which
is probably why it's reporting zero usage. You can do that through code,
config, or JMX. See https://apacheignite.readme.io/docs/memory-metrics.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/