[
https://issues.apache.org/jira/browse/IGNITE-27530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aleksandr reassigned IGNITE-27530:
----------------------------------
Assignee: Aleksandr
> Optimize CLI startup time for non-interactive commands
> ------------------------------------------------------
>
> Key: IGNITE-27530
> URL: https://issues.apache.org/jira/browse/IGNITE-27530
> Project: Ignite
> Issue Type: Improvement
> Reporter: Aleksandr
> Assignee: Aleksandr
> Priority: Major
> Labels: ignite-3
> Time Spent: 20m
> Remaining Estimate: 0h
>
> h2. Problem
> The CLI currently takes ~1.2 seconds to start even for simple commands like
> {{--version}} or {{--help}}. This is because it unconditionally initializes:
> * Jansi ANSI console (~320ms)
> * JLine Terminal for REPL mode (~415ms)
> * Full Micronaut DI context
> h2. Proposed Solution
> Skip Jansi and JLine initialization for non-interactive commands (when args
> are provided or stdin/stdout is redirected). This provides a *4x speedup* for
> common CLI usage.
> h3. Changes:
> # *Main.java*: Conditional initialization of Jansi/JLine based on whether
> we're entering REPL mode
> # *TerminalFactory.java*: Add {{@Lazy}} annotation to defer Terminal creation
> # *ReplExecutorProviderImpl.java*: Add {{@Lazy}} annotation
> # *application.yml*: Disable eager singleton initialization
> # *start.sh*: Add JVM flags {{-XX:TieredStopAtLevel=1}} and
> {{-XX:+UseSerialGC}}
> h2. Expected Results
> || Command || Before || After || Improvement ||
> | {{ignite3 --version}} | ~1.2s | ~0.3s | *4x faster* |
> | {{ignite3 --help}} | ~1.2s | ~0.3s | *4x faster* |
> | REPL mode | ~1.2s | ~1.2s | No change |
> h2. Profiling Data
> Classes loaded for {{--version}}: 5,472
> * JLine Terminal: 415ms (37%)
> * Jansi ANSI: 320ms (28%)
> * Micronaut DI: 194ms (17%)
> * Other: 201ms (18%)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)