flink内存模型

1、详细内存模型

Managed Memory:

各个用途的分配通过 taskmanager.memory.managed.consumer-weights参数进行权重配置。

Network Memory

  •  data record exchange between tasks(网络数据交换)

Framework Memory:

  • You should not change the framework heap memory and framework off-heap memory without a good reason.(不建议修改默认值)。不计入slot资源中。

部署参数配置:

集群部署时,以上三个配置中必须要配置一个,否则启动会失败。

  • 最简单的配置就是指定以下两个配置的一个

  • If you have configured the task heap and managed memory explicitly, it is recommended to set neither total process memory nor total Flink memory. Otherwise, it may easily lead to memory configuration conflicts.(如果配置 task heap and managed memory这两个参数,就不要配置Total Memory,否则容易会造成冲突)

2、调优

2.1 Configure Total Memory

2.2 Configure memory for state backends

只对TaskManagers有效

Heap state backend

RocksDB state backend

  • The first step to try and increase performance should be to increase the amount of managed memory.(增加managed memory)
  • The number of write buffers in RocksDB depends on the number of states you have in your application.(写缓冲取决于状态的数量)
  • If your application has many states and you see frequent MemTable flushes (write-side bottleneck), but you cannot give more memory you can increase the ratio of memory going to the write buffers (state.backend.rocksdb.memory.write-buffer-ratio).(如果程序频繁刷写状态的话,调大刷写内存比例)

2.3 Configure memory for batch jobs

  • Flink will attempt to allocate and use as much managed memory as configured for batch jobs but not go beyond its limits.(在不超过限制的情况下,尽可能多的分配manged memory)

2.4 Configure memory for sort-merge blocking shuffle

  • The number of required network buffers per sort-merge blocking result partition is controlled by taskmanager.network.sort-shuffle.min-buffers and the default value is 64 which is quite small(网络缓冲的默认值是64,太小).you may also need to increase the size of total network memory by adjusting the config values of taskmanager.memory.network.fractiontaskmanager.memory.network.min and taskmanager. memory.network.max to avoid insufficient number of network buffers error.(通过配置网络内存的比例、最小值、最大值来提高网络内存总量的大小)
  • the sort-merge blocking shuffle implementation also uses some unmanaged direct memory for shuffle data writing and reading(排序合并的shuffle操作同样需要direct memory进行读写). you may need to reserve some direct memory for it by increasing the config value of taskmanager.memory.task .off-heap.size(通过增大对外内存的值来增加direct memory).

2.5 Local Execution

只有如下参数会生效

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值