Spark core 2.0 PackedRecordPointer
来源:互联网 发布:淘宝全友旗舰店靠谱吗 编辑:程序博客网 时间:2024/06/05 18:01
** * Wrapper around an 8-byte word that holds a 24-bit partition number and 40-bit record pointer. * <p> * Within the long, the data is laid out as follows: * <pre> * [24 bit partition number][13 bit memory page number][27 bit offset in page] * </pre> * This implies that the maximum addressable page size is 2^27 bits = 128 megabytes, assuming that * our offsets in pages are not 8-byte-word-aligned. Since we have 2^13 pages (based off the * 13-bit page numbers assigned by {@link org.apache.spark.memory.TaskMemoryManager}), this * implies that we can address 2^13 * 128 megabytes = 1 terabyte of RAM per task. * <p> * Assuming word-alignment would allow for a 1 gigabyte maximum page size, but we leave this * optimization to future work as it will require more careful design to ensure that addresses are * properly aligned (e.g. by padding records). */
final class PackedRecordPointer { static final int MAXIMUM_PAGE_SIZE_BYTES = 1 << 27; // 128 megabytes /** * The maximum partition identifier that can be encoded. Note that partition ids start from 0. */ static final int MAXIMUM_PARTITION_ID = (1 << 24) - 1; // 16777215 /** * The index of the first byte of the partition id, counting from the least significant byte. */ static final int PARTITION_ID_START_BYTE_INDEX = 5; /** * The index of the last byte of the partition id, counting from the least significant byte. */ static final int PARTITION_ID_END_BYTE_INDEX = 7; /** Bit mask for the lower 40 bits of a long. */ private static final long MASK_LONG_LOWER_40_BITS = (1L << 40) - 1; /** Bit mask for the upper 24 bits of a long */ private static final long MASK_LONG_UPPER_24_BITS = ~MASK_LONG_LOWER_40_BITS; /** Bit mask for the lower 27 bits of a long. */ private static final long MASK_LONG_LOWER_27_BITS = (1L << 27) - 1; /** Bit mask for the lower 51 bits of a long. */ private static final long MASK_LONG_LOWER_51_BITS = (1L << 51) - 1; /** Bit mask for the upper 13 bits of a long */ private static final long MASK_LONG_UPPER_13_BITS = ~MASK_LONG_LOWER_51_BITS; /** * Pack a record address and partition id into a single word. * * @param recordPointer a record pointer encoded by TaskMemoryManager. * @param partitionId a shuffle partition id (maximum value of 2^24). * @return a packed pointer that can be decoded using the {@link PackedRecordPointer} class. */ public static long packPointer(long recordPointer, int partitionId) { assert (partitionId <= MAXIMUM_PARTITION_ID); // Note that without word alignment we can address 2^27 bytes = 128 megabytes per page. // Also note that this relies on some internals of how TaskMemoryManager encodes its addresses. final long pageNumber = (recordPointer & MASK_LONG_UPPER_13_BITS) >>> 24; final long compressedAddress = pageNumber | (recordPointer & MASK_LONG_LOWER_27_BITS); return (((long) partitionId) << 40) | compressedAddress; } private long packedRecordPointer; public void set(long packedRecordPointer) { this.packedRecordPointer = packedRecordPointer; } public int getPartitionId() { return (int) ((packedRecordPointer & MASK_LONG_UPPER_24_BITS) >>> 40); } public long getRecordPointer() { final long pageNumber = (packedRecordPointer << 24) & MASK_LONG_UPPER_13_BITS; final long offsetInPage = packedRecordPointer & MASK_LONG_LOWER_27_BITS; return pageNumber | offsetInPage; }}
0 0
- Spark core 2.0 PackedRecordPointer
- spark core 2.0 SortShuffleManager
- spark core 2.0 OutputCommitCoordinator
- spark core 2.0 LiveListenerBus
- spark core 2.0 JobProgressListener
- spark core 2.0 YarnClusterManager
- spark core 2.0 YarnClusterSchedulerBackend
- spark core 2.0 Executor
- spark core 2.0 MetricsConfig
- spark core 2.0 ContextCleaner
- spark core 2.0 TransportClientFactory
- spark core 2.0 DiskBlockManager
- spark core 2.0 DiskStore
- spark core 2.0 StorageMemoryPool
- spark core 2.0 ChunkedByteBufferOutputStream
- spark core 2.0 RedirectableOutputStream
- spark core 2.0 UnifiedMemoryManager
- spark core 2.0 ExecutionMemoryPool
- 详细的KVO总结,包括基本改变,使用案例,注意点.看我就够了!
- 简单实现拍照或者从相册中选取并且剪裁
- Tensorflow | 读取csv文件
- Maven OutOfMemoryError: PermGen space
- jlink v8 for s3c2440a 设置
- Spark core 2.0 PackedRecordPointer
- jmeter发送soap请求-webservice接口
- 垂直同步是什么意思,到底是打开还是关闭垂直同步?
- nginx反向代理
- 在sqlite 中android如何转义特殊字符
- js获取当地时间并且拼接时间格式的三种方式
- apache mahout 主要算法
- Can't connect to Mysql server on xxx (10038)
- 基于jmeter3.0版本的csv data set config二次开发(实现从指定行开始读取)