How to fix Java heap space error in Talend? - talend

I have an ETL flow through talend and there:
Read the zipped files from a remote server with a job.
Take this files unzipes them and parse them into HDFS with a job. Inside the job exists a schema check so if something is not
My problem is that TAC server stopes the execution because of this error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.talend.fileprocess.TOSDelimitedReader$ColumnBuffer4Joiner.saveCharInJoiner(TOSDelimitedReader.java:503)
at org.talend.fileprocess.TOSDelimitedReader.joinAndRead(TOSDelimitedReader.java:261)
at org.talend.fileprocess.TOSDelimitedReader.readRecord_SplitField(TOSDelimitedReader.java:148)
at org.talend.fileprocess.TOSDelimitedReader.readRecord(TOSDelimitedReader.java:125)
....
Is there any option to avoid and handle this error automatically?
There are only few files which cause this error but I want to find a solution for further similar situation.

In the TAC Job Conductor, for a selected job, you can add JVM parameters.
Add the -Xmx parameter to specify the maximum heap size. The default value depends on various factors like the JVM release/vendor, the actual memory of the machine, etc... In your situation, the java.lang.OutOfMemoryError: Java heap space reveals that the default value is not enough for this job so you need to override it.
For example, specify -Xmx2048m for 2048Mb or 2gb

#DrGenius Talend has java based environment and some default jvm heap is awarded during initialization, as in for any java program. Default for Talend - Min:256MB (xms) & max:1024MB.. As per your job requirement, you can set the range of min/max jvm like min of 512 mb & max 8gb..
This can be modified from Job run tab - advance setting.. Even this can be parameterized and can be overwritten using variables set in env. Exact value can be seen from job build -> _run.sh ..
But be careful not to set high as too high so that other jobs running on same server is depleted of memory.
More details on heap error & how to debug issue:
https://dzone.com/articles/java-out-of-memory-heap-analysis

Related

updating yarn.scheduler memory

Total Noob here, I installed Cloudera Manager on single node on aws ec2. I followed the install wizard but when I try running
spark-shell or pyspark I get the following error message:
ERROR spark.SparkContext: Error initializing SparkContext.
java.lang.IllegalArgumentException: Required executor memory (1024+384
MB) is above the max threshold (1024 MB) of this cluster! Please check
the values of 'yarn.scheduler.maximum-allocation-mb' and/or
'yarn.nodemanager.resource.memory-mb'.
Can somebody explain to me what is going on or where to begin reading? Total noob, here so any help or direction is greatly appreciated
The required executor memory is above the maximum threshold. You need to increase the YARN memory.
The values of yarn.scheduler.maximum-allocation-mb and yarn.nodemanager.resource.memory-mb both live in the config file yarn-site.xml which is managed by Cloudera Manager in your case.
yarn.nodemanager.resource.memory-mb is the amount of physical memory, in MB, that can be allocated for containers.
yarn.scheduler.maximum-allocation-mb is the maximum memory in mb that cab be allocated per yarn container. The maximum allocation for every container request at the RM, in MBs. Memory requests higher than this won't take effect, and will get capped to this value.
You can read more on the definitions and default values here: https://hadoop.apache.org/docs/r2.4.1/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
In the Cloudera Manager user interface, go to Yarn service > Configurations > Search and increase the values of them.
Restart YARN for the changes to take effect.

Huge amount of memory is required for deploy WAR file using jboss-CLI

I use wildfly appserver, when deploying a war file using Command-Line Interface (CLI) the process requires JVM heap size greater than 10 times the war file size.
How can I reduce this memory size that is consumed by jboss-cli during the deployment.
Problem detail:
I have to deploy 8 war files with 100 MB for each file, this process is applied in one transaction using "batch" and "batch.run", the memory consumed by this process exceeds 8GB.
I'm using the batch behavior because i have remote injections between wars, and i don't know the deployment order.
My question is how can I reduce the memory size consumed by wildfly when using jboss-cli, and if there is no way to reduce it, how can i know the deployment order between wars. (e.g. if app1 injects a remote session bean from app2, then the app2 must be deployed before app1).
You can define JVM options in $JAVA_OPTS environment variable, which will be loaded by WildFly.
For default JVM behavior take a brief look into bin/standalone.conf or bin/domain.conf.

How to disable thread groups externally in JMeter

I am using JMETER with my Powershell script and my JMX (XML for Jmeter) file is already created and I Launch the JMETER in Non-GUI mode and pass the JMX to it.
But previously it was working but I added some more Thread Groups with multiple HTTP requests now there may be some heap size issue.
So I thought of disabling some thread groups from the command line using my Automation script(Powershell).
How to disable some thread groups in the JMX file through the command line?
Define number of threads (virtual users) for Thread Groups using __P() function like:
${__P(group1threads,)} - for 1st thread group
${__P(group2threads,)} - for 2nd thread group
etc.
If you want to disable a certain Thread Group - just set "Number of Threads" to 0 via -J command-line argument like:
jmeter -Jgroup1threads=0 -Jgroup2threads=50 etc
However a better idea would be increasing Heap size as JMeter comes with quite low value (512 Mb) by default which is fine for tests development and debugging, but definitely not enough for the real load test. In order to do it locate the following line in JMeter startup script:
HEAP=-Xms512m -Xmx512m
And update the values to be something like 80% of your total available physical RAM. JMeter restart will be required to pick the new Heap size values up. For more information on JMeter tuning refer to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure guide.
This is exactly explained in this article.
When you have multiple thread groups, you can execute a specific thread group from command line. You need to simply make the thread count to be 0 for the thread group.
Test Plan Design:
Lets say I have 5 thread groups like this. Instead of hardcoding the thread count values, use some property variables. ex: ${__P(user.registration.usercount)}
Now I want to execute only User Login & Order Creation. This can be achieved by passing properties directly throw command line / passing the property file name itself.
Properties:
Execution:
jmeter -n -t test.jmx -p mypropfile.properties
Check the JMeter command line options here.
If you are working with Concurrency Thread Groups and want to disable them with a property you could set the Hold Target Rate Time to zero. (or Target Concurrency to zero)
Set the property in user.properties
TG1-target_hold_rate_in_min=0
or
Set the property through the command line
jmeter -TG1-target_hold_rate_in_min =0

Kafka failed to map 1073741824 bytes for committing reserved memory

I am installing kafka on an aws t2 instance(one that has 1gb of memory).
(1) I download kafka_2.11-0.9.0.0
(2) I run zookeeper bin/zookeeper-server-start.sh config/zookeeper.properties
(3) I try running bin/kafka-server-start.sh config/server.properties
and I get
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
.#
.# There is insufficient memory for the Java Runtime Environment to continue.
.# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
.# An error report file with more information is saved as:
.# /home/machine_name/kafka_2.11-0.9.0.0/hs_err_pid9161.log
I checked all propertes in the server.properties config file and in the documentation for properties that could try to do something like this but coudn't find anything.
Does anyone know why is kafka trying to allocated 1 gb when starting?
Kafka defaults to the following jvm memory parameters which mean that kafka will allocate 1GB at startup and use a maximum of 1GB of memory:
-Xmx1G -Xms1G
Just set KAFKA_HEAP_OPTS env variable to whatever you want to use instead. You may also just edit ./bin/kafka-server-start.sh and replace the values.
also if you have lower memory heap then try to reduce the size
-Xmx400M -Xms400M for both zookeeper and kafka
This issue might also relate to the maximum number of memory map areas allocated. It throws exactly the same error.
To remedy this you can run the following:
sysctl -w vm.max_map_count=200000
You want to set this in relation to your File Descriptor Limits. In summary, for every log segment on a broker, you require two map areas - one for index and one for time index.
For reference see the Kafka OS section: https://kafka.apache.org/documentation/#os
I was getting Java IO Exception: Map failed while starting Kafka-server. By analyzing previous logs it looks like it was failed because of insufficient memory in the java heap while loading logs. I changed the maximum memory size but it was not able to fix it. Finally, doing more research on google, I got to know that I had downloaded 32-bit version of java so downloading 64-bit version of java solved my problem.
Pass the KAFKA_HEAP_OPTS argument with your required memory value to run with.
Make sure to pass it in quotes - KAFKA_HEAP_OPTS="-Xmx512M -Xms512M"
docker run -it --rm --network app-tier -e KAFKA_HEAP_OPTS="-Xmx512M -Xms512M" -e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 bitnami/kafka:latest kafka-topics.sh --list --bootstrap-server kafka-server:9092

How to calculate launch configuration properties?

in Eclipse Jboss 7.1 VM arguments
My RAM 8GB
vm arguments have a this like statements ;
-server -Xms64m
-Xmx512m
-XX:MaxPermSize=1024m
how to calculate this bold numbers?
**
Caused by: java.lang.OutOfMemoryError: Java heap space
**
You are getting that error because your server used up all of its available memory (in your case, 512mb). You can increase Xmx param, which sets the maximum amount of memory your server can use.
OutOfMemoryError can happen because of insufficient memory assignment, or memory leaks (objects that java's garbage collector can't delete, despite not being needed).
There is no magic rule to calculate those params, they depend on what you are deploying to jboss, how much concurrent users, etc, etc, etc.
You can try increasing Xmx param, and check with jvisualvm the memory usage, see how it behaves..