This is an automated email from the ASF dual-hosted git repository.
LuciferYang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 11ccf5829e [GLUTEN-13543][CORE] Count compression time in RSS hash
shuffle evictions (#13549)
11ccf5829e is described below
commit 11ccf5829eaddb149c4252369f6ff378a7c0413e
Author: YangJie <[email protected]>
AuthorDate: Thu Nov 26 23:48:24 2026 -0500
[GLUTEN-13543][CORE] Count compression time in RSS hash shuffle evictions
(#13549)
## What changes are proposed in this pull request?
`RssPartitionWriter::doEvict` compressed the block before its `spillTime_`
timer started and never added the payload's compression time to
`compressTime_`, so RSS hash shuffle always reported zero compression time.
This starts the timer at the top of `doEvict` and adds the compression time,
the same way `sortEvict` already does. `stop()` subtracts `compressTime_` from
`spillTime_`, so the push time still excludes compression.
The Celeborn and Uniffle writers now also add the compression time to the
"time to compress" metric, as `ColumnarShuffleWriter` does. As a result, "time
to compress" is no longer 0 for Celeborn and Uniffle, the "time to split"
metric of both no longer counts compression, and Uniffle's shuffle write time
now includes it.
Fixes #13543.
## How was this patch tested?
Added `rssCompressTime` to `VeloxShuffleWriterTest`. It runs the hash
shuffle writer with the RSS partition writer and a codec, and checks that
`totalCompressTime()` is greater than 0. Before this change it was always 0.
## Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Opus.
---
.../shuffle/VeloxCelebornColumnarShuffleWriter.scala | 1 +
.../writer/VeloxUniffleColumnarShuffleWriter.java | 1 +
cpp/core/shuffle/rss/RssPartitionWriter.cc | 5 ++++-
cpp/velox/tests/VeloxShuffleWriterTest.cc | 16 ++++++++++++++++
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git
a/backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala
b/backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala
index 7123525a8a..99318cb047 100644
---
a/backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala
+++
b/backends-velox/src-celeborn/main/scala/org/apache/spark/shuffle/VeloxCelebornColumnarShuffleWriter.scala
@@ -121,6 +121,7 @@ class VeloxCelebornColumnarShuffleWriter[K, V](
dep.metrics("c2rTime").add(splitResult.getC2RTime)
}
dep.metrics("dataSize").add(splitResult.getRawPartitionLengths.sum)
+ dep.metrics("compressTime").add(splitResult.getTotalCompressTime)
writeMetrics.incBytesWritten(splitResult.getBytesWritten)
writeMetrics.incWriteTime(splitResult.getTotalWriteTime +
splitResult.getTotalPushTime)
diff --git
a/backends-velox/src-uniffle/main/java/org/apache/spark/shuffle/writer/VeloxUniffleColumnarShuffleWriter.java
b/backends-velox/src-uniffle/main/java/org/apache/spark/shuffle/writer/VeloxUniffleColumnarShuffleWriter.java
index c6a11fb1f3..7d916ed9c4 100644
---
a/backends-velox/src-uniffle/main/java/org/apache/spark/shuffle/writer/VeloxUniffleColumnarShuffleWriter.java
+++
b/backends-velox/src-uniffle/main/java/org/apache/spark/shuffle/writer/VeloxUniffleColumnarShuffleWriter.java
@@ -256,6 +256,7 @@ public class VeloxUniffleColumnarShuffleWriter<K, V>
extends RssShuffleWriter<K,
columnarDep.metrics().get("sortTime").get().add(splitResult.getSortTime());
columnarDep.metrics().get("c2rTime").get().add(splitResult.getC2RTime());
}
+
columnarDep.metrics().get("compressTime").get().add(splitResult.getTotalCompressTime());
// bytesWritten is calculated in uniffle side:
WriteBufferManager.createShuffleBlock
// shuffleWriteMetrics.incBytesWritten(splitResult.getTotalBytesWritten());
diff --git a/cpp/core/shuffle/rss/RssPartitionWriter.cc
b/cpp/core/shuffle/rss/RssPartitionWriter.cc
index 20104d479b..3b12a4007e 100644
--- a/cpp/core/shuffle/rss/RssPartitionWriter.cc
+++ b/cpp/core/shuffle/rss/RssPartitionWriter.cc
@@ -113,10 +113,14 @@ arrow::Status RssPartitionWriter::doEvict(
uint32_t partitionId,
std::unique_ptr<InMemoryPayload> inMemoryPayload,
int64_t& evictBytes) {
+ // Time the whole eviction (including the compression below): stop() carves
compressTime_
+ // out of spillTime_, so compression must sit inside this window, as in
sortEvict.
+ ScopedTimer timer(&spillTime_);
rawPartitionLengths_[partitionId] += inMemoryPayload->rawSize();
auto payloadType = codec_ ? Payload::Type::kCompressed :
Payload::Type::kUncompressed;
ARROW_ASSIGN_OR_RAISE(
auto payload, inMemoryPayload->toBlockPayload(payloadType,
payloadPool_.get(), codec_ ? codec_.get() : nullptr));
+ compressTime_ += payload->getCompressTime();
// Copy payload to arrow buffered os.
ARROW_ASSIGN_OR_RAISE(auto rssBufferOs,
arrow::io::BufferOutputStream::Create(options_->pushBufferMaxSize));
@@ -127,7 +131,6 @@ arrow::Status RssPartitionWriter::doEvict(
payload = nullptr; // Invalidate payload immediately.
// Push.
- ScopedTimer timer(&spillTime_);
ARROW_ASSIGN_OR_RAISE(auto buffer, rssBufferOs->Finish());
auto delta = rssClient_->pushPartitionData(
partitionId,
reinterpret_cast<char*>(const_cast<uint8_t*>(buffer->data())), buffer->size());
diff --git a/cpp/velox/tests/VeloxShuffleWriterTest.cc
b/cpp/velox/tests/VeloxShuffleWriterTest.cc
index 668c00888d..0fb7e2f296 100644
--- a/cpp/velox/tests/VeloxShuffleWriterTest.cc
+++ b/cpp/velox/tests/VeloxShuffleWriterTest.cc
@@ -863,6 +863,22 @@ TEST_P(HashPartitioningShuffleWriterTest,
hashPart3Vectors) {
*shuffleWriter, {hashInputVector1_, hashInputVector2_,
hashInputVector1_}, 2, {blockPid2, blockPid1});
}
+TEST_P(HashPartitioningShuffleWriterTest, rssCompressTime) {
+ const auto& params = GetParam();
+ if (params.shuffleWriterType != ShuffleWriterType::kHashShuffle ||
+ params.partitionWriterType != PartitionWriterType::kRss ||
+ params.compressionType == arrow::Compression::UNCOMPRESSED) {
+ GTEST_SKIP() << "Only checks the hash shuffle writer with the RSS
partition writer and a codec.";
+ }
+ auto shuffleWriter = createShuffleWriter(2);
+ for (int i = 0; i < 8; ++i) {
+ ASSERT_NOT_OK(splitRowVector(*shuffleWriter, hashInputVector1_));
+ }
+ ASSERT_NOT_OK(shuffleWriter->stop());
+ // RSS evictions compress every block, so the compression time must be
reported.
+ EXPECT_GT(shuffleWriter->totalCompressTime(), 0);
+}
+
TEST_P(HashPartitioningShuffleWriterTest, hashLargeVectors) {
const int32_t expectedMaxBatchSize = 8;
auto shuffleWriter = createShuffleWriter(2);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]