首页 > 其他分享 >dremio cloud cache 简单说明

dremio cloud cache 简单说明

时间:2024-02-06 09:13:06浏览次数:52  
标签:dremio fs java cache operatorContext FileSystem com cloud

dremio cloud cache 实际上就是对于云文件系统的cache加速(比如hdfs,s3。。。),在处理的时候使用了ce 包装的包,详细源码并没有开源
我们可以通过一些代码整体看下实现

参考处理

dremio-ce-services-cachemanager 中的处理

  • ce caache 管理配置
dremio: {
  classpath.scanning: {
    packages += "com.dremio.service.cachemanager"
  }
  filesystemwrapper.class = "com.dremio.service.cachemanager.CacheFileSystemWrapper"
}
  • 创建
    SabotContext 中
// 使用了LoggedFileSystemWrapper 一个包含日志,以及基于动态类加载 (dremio.filesystemwrapper.class 这个config 文件中的key)
  this.fileSystemWrapper = new LoggedFileSystemWrapper(
        config.getInstance(
            FileSystemWrapper.FILE_SYSTEM_WRAPPER_CLASS,
            FileSystemWrapper.class,
            (fs, storageId, conf, operatorContext, enableAsync, isMetadataEnabled) -> fs,
            dremioConfig,
            this.optionManager,
            allocator,
            new ServiceSetDecorator(coord.getServiceSet(Role.EXECUTOR)),
            endpoint),
        this.optionManager);
  • LoggedFileSystemWrapper log包装
    LoggedFileSystemWrapper.java 使用的ce 包中的com.dremio.service.cachemanager.CacheFileSystemWrapper
  public FileSystem wrap(FileSystem fs, String storageId, AsyncStreamConf conf, OperatorContext context,
      boolean enableAsync, boolean isMetadataRefresh) throws IOException {
    FileSystem wrappedFs = defaultWrapper.wrap(fs, storageId, conf, context, enableAsync, isMetadataRefresh);
    if (LoggedFileSystem.isLoggingEnabled()) {
      // use options from the OperatorContext if available, otherwise fall back to global options
      OptionResolver options = context != null && context.getOptions() != null ? context.getOptions() : globalOptions;
      wrappedFs = new LoggedFileSystem(wrappedFs, options);
    }
    return wrappedFs;
  }
  • 使用
    核心是FileSystemPlugin,在createFS 部分,实际上还是一个FileSystem 子类
    参考代码(使用的SabotContext 的getFileSystemWrapper 方法)
public FileSystem createFS(String userName, OperatorContext operatorContext, boolean metadata) throws IOException {
// newFileSystem 底层实际上是hdfs 的FileSystem
  return context.getFileSystemWrapper().wrap(newFileSystem(userName, operatorContext), name, config, operatorContext,
      isAsyncEnabledForQuery(operatorContext) && getConfig().isAsyncEnabled(), metadata);
}

newFileSystem 处理

 protected FileSystem newFileSystem(String userName, OperatorContext operatorContext) throws IOException {
    // Create underlying filesystem
    if (Strings.isNullOrEmpty(userName)) {
      throw new IllegalArgumentException("Invalid value for user name");
    }
 
    final org.apache.hadoop.fs.FileSystem fs;
    try {
      fs = hadoopFS.get(getFSUser(userName));
    } catch (ExecutionException e) {
      Throwable cause = e.getCause();
      Throwables.propagateIfPossible(cause, IOException.class);
      throw new RuntimeException(cause != null ? cause : e);
    }
   // HadoopFileSystem 是dremio 对于FileSystem 的一个hdfs 实现,实际内部文件读取还是基于了hdfs 的FileSystem
    return HadoopFileSystem.get(fs, (operatorContext == null) ? null : operatorContext.getStats(),
        isAsyncEnabledForQuery(operatorContext) && getConfig().isAsyncEnabled());
  }
  • 实际使用配置
services: {
  coordinator.enabled: false,
  coordinator.master.enabled: false,
  executor.enabled: true
  executor.cache.path.db : "/mnt/cachemanagerdisk/db",
  executor.cache.path.fs : [ "/mnt/cachemanagerdisk/dir1","/mnt/cachemanagerdisk/dir2","/mnt/cachemanagerdisk/dir3","/mnt/cachemanagerdisk/dir4"]
}

说明

以上是一个简单的说明,以及对于代码位置的说明,ce 包中的详细设计可以通过反编译查看,实际上按照此模式我们基于alluxio以及juicefs 也是可以直接
替代的,而且对于大量文件系统的性能会比默认的实现更好

参考资料

sabot/kernel/src/main/java/com/dremio/exec/store/dfs/FileSystemWrapper.java
sabot/kernel/src/main/java/com/dremio/exec/store/dfs/LoggedFileSystemWrapper.java
sabot/kernel/src/main/java/com/dremio/exec/server/SabotContext.java
sabot/kernel/src/main/java/com/dremio/exec/store/dfs/FileSystemPlugin.java
sabot/kernel/src/main/java/com/dremio/exec/hadoop/HadoopFileSystem.java
https://docs.dremio.com/current/get-started/cluster-deployments/customizing-configuration/dremio-conf/cloud-cache-config/
https://www.dremio.com/blog/how-dremio-delivers-fast-queries-on-object-storage-apache-arrow-reflections-and-the-columnar-cloud-cache/
https://community.dremio.com/t/caching-on-prem-implementation/8959/6
https://www.cnblogs.com/rongfengliang/p/16228551.html

标签:dremio,fs,java,cache,operatorContext,FileSystem,com,cloud
From: https://www.cnblogs.com/rongfengliang/p/18003547

相关文章

  • 浅谈LocalCache | 京东云技术团队
    1、什么是LocalCache?本地缓存是一种将数据存储在应用程序内存中的机制,用于提高数据访问的性能和响应速度。它通过在内存中维护一个键值对的存储结构,允许应用程序快速检索和访问数据,而无需每次都从慢速的数据源(如数据库或网络)获取数据。2、LocalCache优缺点1)优点•快速访问:Loca......
  • 浅谈LocalCache | 京东云技术团队
    1、什么是LocalCache?本地缓存是一种将数据存储在应用程序内存中的机制,用于提高数据访问的性能和响应速度。它通过在内存中维护一个键值对的存储结构,允许应用程序快速检索和访问数据,而无需每次都从慢速的数据源(如数据库或网络)获取数据。2、LocalCache优缺点1)优点•快速访问:LocalCach......
  • SpringCloud工程添加openfeign使用服务之间调用
    SpringCloud服务之间的调用可以采用openfeign,今天这里就简单记录下需要做的步骤。前置条件就是微服务都建好了,并且两个服务都注册到nacos上,这里用两个微服务模块。简单描述:请求A模块,然后去调用B模块数据,最后从A模块接口返回。需要在A模块添加openfeign的依赖和service写好接口,B......
  • VMware Cloud Foundation (VCF) - 多云全栈基础架构组合解决方案
    VMwareCloudFoundation(VCF)-多云全栈基础架构组合解决方案fullstackinfrastructurewithaplatform请访问原文链接:https://sysin.org/blog/vmware-cloud-foundation/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.orgVMwarebyBroadcom产品组合:VMwareCl......
  • 【转帖】Cache一致性协议与MESI(2)
    http://www.valleytalk.org/2011/07/11/cache%E4%B8%80%E8%87%B4%E6%80%A7%E5%8D%8F%E8%AE%AE%E4%B8%8Emesi2/ 分享分享到: 新浪微博 腾讯微信 开心 人人 Live Digg FB TwitterWriteinvalidate提供了实现Cache一致性的简单思想,处理器上会有一套完整的协......
  • Java Integer包装类缓存(cache)
    ​ Java的Integer类有一个内部的缓存机制,主要用于优化自动装箱(autoboxing)和拆箱(unboxing)的性能。这个特性首次引入于Java5,旨在减少对频繁使用的小整数值的重复对象创建,从而提高性能和减少内存使用。 参数文档:JavaInteger包装类缓存(cache)-CJavaPy1、缓存范围默认情况下,I......
  • cloudreve中的通用返回对象的处理
    cloudreve中的通用返回对象的处理包名:serializer基础化的响应结构体//Response基础序列化器typeResponsestruct{Codeint`json:"code"`Datainterface{}`json:"data,omitempty"`Msgstring`json:"msg"`Error......
  • 四、SpringCloud alibaba 之 OpenFeign
    4.1、调用过程的演化JAVA项目中如何实现接口调用?远程调用工具描述HttpClientHttpClient是ApacheJakartaCommon下的子项目,用来提供高效的、最新的、功能丰富的支持Http协议的客户端编程工具包,并且它支持HTTP协议最新版本和建议。HttpClient相比传统JDK自......
  • spring cloud与加密库jasypt(ulisesbocchio)冲突问题定位
    背景最近在项目上遇到个问题。项目就是普通的springcloud,springcloud在springboot的基础上多了一些东西,比如支持bootstrap上下文(通过bootstrap.yml/properties配置)。另外呢,我们这边要求上线的时候,要把配置文件里的敏感配置如密码,进行加密。加密的话,我们这边用了如下库:<depend......
  • 极狐 GitLab 和 Xcode Cloud 集成,实现 iOS 的自动打包
    一直以来,iOS/macOS开发者面临一个难题:大部分云厂商只提供Linux/Windows服务器,而不提供Mac,如果想实现「持续集成自动打包」就需要绑定自己的Mac作为构建机。如果用个人Mac,一旦关机,小组同事就无法构建;如果再买一台公共Mac,又造成浪费。2022年6月,Apple在WWDC(全球开发者......