summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-04 10:57:22 +0300
committerPaul Buetow <paul@buetow.org>2025-07-04 10:57:22 +0300
commitaa2f547cf2b6136dc60f541f30c27a426ec7c6c8 (patch)
tree6180691fc7a0753f82c16aefdbf7da078928a3ae
parentbecf8a2ea235ee37adceabc1733ae8727cec5488 (diff)
refactor: change turbo boost to be enabled by default
- Changed environment variable from DTAIL_TURBOBOOST_ENABLE to DTAIL_TURBOBOOST_DISABLE - Changed config field from TurboModeEnable to TurboBoostDisable - Turbo boost is now enabled by default and must be explicitly disabled - Updated all code references, documentation, and examples - No change in functionality, only inverted the boolean logic This makes turbo boost opt-out rather than opt-in, providing better default performance for large files while allowing users to disable it for scenarios where it adds overhead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
-rw-r--r--CLAUDE.md4
-rw-r--r--examples/dtail.json.example2
-rwxr-xr-xexamples/dtail.schema.json4
-rw-r--r--internal/config/initializer.go8
-rw-r--r--internal/config/server.go12
-rw-r--r--internal/mapr/server/turbo_aggregate_test.go4
-rw-r--r--internal/server/handlers/mapcommand.go8
-rw-r--r--internal/server/handlers/readcommand.go12
8 files changed, 27 insertions, 27 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 52f7b14..c609020 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -115,7 +115,7 @@ make profile-help
## Known Limitations
### Turbo Mode and MapReduce Operations
-Turbo mode (DTAIL_TURBOBOOST_ENABLE) provides performance optimizations for both direct output operations (cat, grep, tail) and MapReduce operations when running in server mode.
+Turbo boost mode is enabled by default and provides performance optimizations for both direct output operations (cat, grep, tail) and MapReduce operations when running in server mode. It can be explicitly disabled via DTAIL_TURBOBOOST_DISABLE=yes or TurboBoostDisable in the config file.
**Technical Details:**
- For cat/grep/tail: Turbo mode bypasses channels for direct writing
@@ -136,7 +136,7 @@ When turbo mode is enabled and using dserver:
- Improved synchronization in both regular and turbo aggregate implementations
**Best Practices for High-Concurrency MapReduce:**
-1. Enable turbo mode for server deployments: `export DTAIL_TURBOBOOST_ENABLE=yes`
+1. Turbo boost is enabled by default. To disable if needed: `export DTAIL_TURBOBOOST_DISABLE=yes`
2. Increase MaxConcurrentCats in the server configuration to match workload
3. Use server mode for large-scale MapReduce operations
4. Monitor logs for performance metrics
diff --git a/examples/dtail.json.example b/examples/dtail.json.example
index f21d114..2c5b508 100644
--- a/examples/dtail.json.example
+++ b/examples/dtail.json.example
@@ -97,7 +97,7 @@
"MaxConcurrentTails": 50,
"MaxConnections": 50,
"MaxLineLength": 1048576,
- "TurboModeEnable": true,
+ "TurboBoostDisable": false,
"Permissions": {
"Default": [
"readfiles:^/.*$"
diff --git a/examples/dtail.schema.json b/examples/dtail.schema.json
index 5690ad7..4fd47b6 100755
--- a/examples/dtail.schema.json
+++ b/examples/dtail.schema.json
@@ -395,9 +395,9 @@
"minimum": 1024,
"maximum": 10240000
},
- "TurboModeEnable": {
+ "TurboBoostDisable": {
"type": "boolean",
- "description": "Enable turbo mode for optimized file processing (disabled by default for MapReduce)"
+ "description": "Disable turbo boost mode. By default, turbo boost is enabled for optimized file processing"
},
"Permissions": {
"type": "object",
diff --git a/internal/config/initializer.go b/internal/config/initializer.go
index e750a1a..146d1a0 100644
--- a/internal/config/initializer.go
+++ b/internal/config/initializer.go
@@ -92,10 +92,10 @@ func (in *initializer) processEnvVars(args *Args) {
if len(sshPrivateKeyPathFile) > 0 && args.SSHPrivateKeyFilePath == "" {
args.SSHPrivateKeyFilePath = sshPrivateKeyPathFile
}
- // Check if turbo mode should be enabled from environment variable
- // This allows backward compatibility with existing scripts
- if Env("DTAIL_TURBOBOOST_ENABLE") {
- in.Server.TurboModeEnable = true
+ // Check if turbo boost should be disabled from environment variable
+ // Turbo boost is enabled by default, can be explicitly disabled
+ if Env("DTAIL_TURBOBOOST_DISABLE") {
+ in.Server.TurboBoostDisable = true
}
}
diff --git a/internal/config/server.go b/internal/config/server.go
index d108ea3..efa7335 100644
--- a/internal/config/server.go
+++ b/internal/config/server.go
@@ -67,11 +67,11 @@ type ServerConfig struct {
Ciphers []string `json:",omitempty"`
// The allowed MAC algorithms.
MACs []string `json:",omitempty"`
- // Enable turbo mode for optimized file processing. When enabled, cat/grep/tail operations
- // use a direct writing approach that bypasses internal channels for better performance.
- // Note: This is disabled by default for MapReduce operations due to known issues with
- // high-concurrency aggregate processing.
- TurboModeEnable bool `json:",omitempty"`
+ // Disable turbo boost mode. When set to true, disables the optimized file processing mode.
+ // By default, turbo boost is enabled for cat/grep/tail and MapReduce operations, providing
+ // better performance through direct writing that bypasses internal channels.
+ // Set this to true only if you experience issues with turbo boost mode.
+ TurboBoostDisable bool `json:",omitempty"`
}
// Create a new default server configuration.
@@ -90,7 +90,7 @@ func newDefaultServerConfig() *ServerConfig {
Permissions: Permissions{
Default: defaultPermissions,
},
- TurboModeEnable: false, // Default to false for safety, can be enabled via config
+ TurboBoostDisable: false, // Default to false, meaning turbo boost is enabled by default
}
}
diff --git a/internal/mapr/server/turbo_aggregate_test.go b/internal/mapr/server/turbo_aggregate_test.go
index b247201..ec1d6a3 100644
--- a/internal/mapr/server/turbo_aggregate_test.go
+++ b/internal/mapr/server/turbo_aggregate_test.go
@@ -25,7 +25,7 @@ func TestTurboAggregateVsRegular(t *testing.T) {
if config.Server == nil {
config.Server = &config.ServerConfig{
MapreduceLogFormat: "default",
- TurboModeEnable: false,
+ TurboBoostDisable: false,
}
}
if dlog.Server == nil {
@@ -210,7 +210,7 @@ func TestTurboAggregateConcurrency(t *testing.T) {
if config.Server == nil {
config.Server = &config.ServerConfig{
MapreduceLogFormat: "default",
- TurboModeEnable: false,
+ TurboBoostDisable: false,
}
}
if dlog.Server == nil {
diff --git a/internal/server/handlers/mapcommand.go b/internal/server/handlers/mapcommand.go
index c804189..83c4c75 100644
--- a/internal/server/handlers/mapcommand.go
+++ b/internal/server/handlers/mapcommand.go
@@ -23,10 +23,10 @@ func newMapCommand(serverHandler *ServerHandler, argc int,
m := mapCommand{server: serverHandler}
queryStr := strings.Join(args[1:], " ")
- // If turbo mode is enabled AND we're in server mode (not serverless), create a TurboAggregate
- // Turbo mode is a server-side optimization and should not be used in serverless mode
- dlog.Server.Debug("MapReduce mode check", "turboModeEnable", config.Server.TurboModeEnable, "serverless", serverHandler.serverless)
- if config.Server.TurboModeEnable && !serverHandler.serverless {
+ // If turbo boost is not disabled AND we're in server mode (not serverless), create a TurboAggregate
+ // Turbo boost is enabled by default and is a server-side optimization
+ dlog.Server.Debug("MapReduce mode check", "turboBoostDisable", config.Server.TurboBoostDisable, "serverless", serverHandler.serverless)
+ if !config.Server.TurboBoostDisable && !serverHandler.serverless {
dlog.Server.Info("Creating turbo aggregate for MapReduce", "query", queryStr)
turboAggregate, err := server.NewTurboAggregate(queryStr)
if err != nil {
diff --git a/internal/server/handlers/readcommand.go b/internal/server/handlers/readcommand.go
index 2ce1fc7..7037e5f 100644
--- a/internal/server/handlers/readcommand.go
+++ b/internal/server/handlers/readcommand.go
@@ -123,7 +123,7 @@ func (r *readCommand) readFiles(ctx context.Context, ltx lcontext.LContext,
// In turbo mode, signal EOF after all files are processed
// This is crucial for proper shutdown in server mode
- if config.Server.TurboModeEnable && r.server.aggregate == nil &&
+ if !config.Server.TurboBoostDisable && r.server.aggregate == nil &&
(r.mode == omode.CatClient || r.mode == omode.GrepClient || r.mode == omode.TailClient) {
if r.server.IsTurboMode() && r.server.turboEOF != nil {
dlog.Server.Debug(r.server.user, "Turbo mode: flushing data before EOF signal")
@@ -261,12 +261,12 @@ func (r *readCommand) read(ctx context.Context, ltx lcontext.LContext,
// Check if we should use the turbo boost optimizations
// Enable turbo boost for cat/grep/tail modes, and now also for MapReduce operations
// MapReduce now has a turbo mode implementation that bypasses channels
- dlog.Server.Debug(r.server.user, "Checking turbo mode", "turboModeEnable", config.Server.TurboModeEnable,
+ dlog.Server.Debug(r.server.user, "Checking turbo mode", "turboBoostDisable", config.Server.TurboBoostDisable,
"mode", r.mode, "hasTurboAggregate", r.server.turboAggregate != nil, "hasAggregate", r.server.aggregate != nil)
// Only use turbo mode if:
- // 1. Turbo mode is enabled AND
+ // 1. Turbo boost is NOT disabled (it's enabled by default) AND
// 2. We have a turbo aggregate OR (we're in cat/grep/tail mode AND we don't have a regular aggregate)
- if config.Server.TurboModeEnable &&
+ if !config.Server.TurboBoostDisable &&
(r.server.turboAggregate != nil || ((r.mode == omode.CatClient || r.mode == omode.GrepClient || r.mode == omode.TailClient) && r.server.aggregate == nil)) {
dlog.Server.Info(r.server.user, "Using turbo mode for reading", path, "mode", r.mode, "hasTurboAggregate", r.server.turboAggregate != nil)
r.readWithTurboProcessor(ctx, ltx, path, globID, re, reader)
@@ -327,8 +327,8 @@ func (r *readCommand) readWithProcessor(ctx context.Context, ltx lcontext.LConte
aggregate := r.server.aggregate
var lines chan *line.Line
- // Use the optimized version if turbo boost is enabled
- turboBoostEnabled := config.Server.TurboModeEnable
+ // Use the optimized version if turbo boost is not disabled (enabled by default)
+ turboBoostEnabled := !config.Server.TurboBoostDisable
for {
if aggregate != nil {