Yarn app not big so much, I run Apache Kylin and buid cubes. When running, Yarn app follow my memory setting. But for CPU, even when I set limit for CPU, it always exceed over my limit. I mean when I set CPU limit 80%, but when app running , it reach to 100% even 200%
You will need to enable CPU scheduling. by default yarn only accounts for ram. if you enable cpu scheduling, each yarn app will ram for and cpu, and yarn will provide containers based on what is available per your ram and CPU limits. if cpu scheduling is not enabled, very difficult to limit.
Most of the time, increasing the container size (map, reduce and tez) would reduce the CPU load.
Setting YARN container memory values is a balancing act between memory (RAM), processors (CPU cores), and disks so that processing is not constrained by any one of these cluster resources.
However, if the application usage pattern is known, the containers can be tuned to influence and maximize the resources utilization.
For example, if CPU usage and load average are too large, an increase in the container size reduces the number of containers allocated per node. A good rule of thumb is not to have the load average bigger than 4 times the number of physical core.
Then a likely cause for having large amounts of CPU used is Garbage Collections and especially continuous Garbage Collection which would be helped by a larger container.
Increase by 50% the following and observe any changes:
Please look at the Java heap size. Try increasing heap size first. This will give you more memory to prevent many GC cycles. You want high CPU usage for your application just not for GC and other applications.
Also, please check to see if other applications are running. Running Linux top command may help to see if other tasks are running and where the CPU is being used.