Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to call Jni Program in Spark

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to call the Jni program in Spark, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Handle the resource destruction problem in the 1.jni call.

From saprk on yarn mode, every time a task is submitted, a group of processes are started and destroyed after the task is completed. Therefore, as long as there is only one copy of global resources, memory leaks and system crashes can be guaranteed.

Static objects can be shared among multiple methods in a 2.jni program.

The 3.corsegenbackend process is created when the task is submitted and destroyed after the task execution is completed. The number of this process is set through-- num-executors in yarn mode.

4. On spark, tasks may run on multiple processes. If the jni program contains C++ static objects, how to ensure that static objects are initialized and loaded only once?

Solution:

1. Written in mapparition, but being called too many times is a disadvantage.

two。 Writing in the static block ensures that each process calls the method only once.

The mappartitions method in 5.spark may be map only once if df.first () is called once in the background.

The above is how to call the Jni program in Spark. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report