简体   繁体   中英

Hadoop HDFS java client usage

I have a java application which needs to read and write files to HDFS. I do use FileSystem fs = FileSystem.get(configuration);

And it works well.

Now the question is : should I keep this reference and use it as a singleton or should I use it only once and get a new one each time?

If it matters, I need to say that the application targets a quite high traffic.

Thanks

I think the answer depends on relation of two numbers - network bandwidth (between HDFS client and HDFS cluster) and amount of data per second you can feed to HDFS client. If first is higher - then having a few connections in the same time makes sense.
Usually 2-3 concurrent connections are optimal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM