Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Spark job fail with "too many open files"?

Tags:

apache-spark

I get "too many open files" during the shuffle phase of my Spark job. Why is my job opening so many files? What steps can I take to try to make my job succeed.

like image 718
samthebest Avatar asked Sep 07 '14 06:09

samthebest


1 Answers

This has been answered on the spark user list:

The best way is definitely just to increase the ulimit if possible, this is sort of an assumption we make in Spark that clusters will be able to move it around.

You might be able to hack around this by decreasing the number of reducers [or cores used by each node] but this could have some performance implications for your job.

In general if a node in your cluster has C assigned cores and you run a job with X reducers then Spark will open C*X files in parallel and start writing. Shuffle consolidation will help decrease the total number of files created but the number of file handles open at any time doesn't change so it won't help the ulimit problem.

-Patrick Wendell

like image 93
samthebest Avatar answered Sep 23 '22 07:09

samthebest