[ 
https://issues.apache.org/jira/browse/FLINK-36781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17900751#comment-17900751
 ] 

k walton commented on FLINK-36781:
----------------------------------

I've got a small fix locally which seems to address the issue, so I'd love to 
make this my first contribution if this could be assigned to me.

I'd also appreciate feedback on the fix as well, since it may interfere with 
highlighting / setting updates to the client, the diff for my local fix is 
pretty simple
{code:java}
diff --git 
a/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/parser/SqlClientSyntaxHighlighter.java
 
b/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/parser/SqlClientSyntaxHighlighter.java
index 75e773b2ba6..ba2ff6dda2c 100644
--- 
a/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/parser/SqlClientSyntaxHighlighter.java
+++ 
b/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/parser/SqlClientSyntaxHighlighter.java
@@ -48,14 +48,15 @@ public class SqlClientSyntaxHighlighter extends 
DefaultHighlighter {
                             .collect(Collectors.toSet()));
 
     private final Executor executor;
+    private final ReadableConfig configuration;
 
     public SqlClientSyntaxHighlighter(Executor executor) {
         this.executor = executor;
+        this.configuration = executor.getSessionConfig();
     }
 
     @Override
     public AttributedString highlight(LineReader reader, String buffer) {
-        ReadableConfig configuration = executor.getSessionConfig();
         final SyntaxHighlightStyle.BuiltInStyle style =
                 SyntaxHighlightStyle.BuiltInStyle.fromString(
                         
configuration.get(SqlClientOptions.DISPLAY_DEFAULT_COLOR_SCHEMA));
{code}

> Flink SQL REPL Remote Gateway lag
> ---------------------------------
>
>                 Key: FLINK-36781
>                 URL: https://issues.apache.org/jira/browse/FLINK-36781
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Client, Table SQL / Gateway
>    Affects Versions: 1.20.0
>         Environment: This was noticed when spawning a gateway on a remote 
> kubernetes cluster and connecting through a port forward, which exacerbated 
> the lag. But I've captured screenshots of the network requests on each key 
> press on wireshark locally, which I've attached a recording of for clarity.
>  
> You can reproduce this by doing the following:
>  # Have docker installed
>  # in one terminal run a host gateway
> {code:java}
> docker run -p 8083:8083 --rm -it --entrypoint /bin/bash flink:1.20 -c 
> "/opt/flink/bin/start-cluster.sh && /opt/flink/bin/sql-gateway.sh 
> start-foreground -D sql-gateway.endpoint.rest.port=8083 -D 
> sql-gateway.endpoint.rest.address=localhost" {code}
>  # in a second terminal run a sql client connected to it, on my machine the 
> command is
> {code:java}
> /opt/homebrew/opt/apache-flink/libexec/bin/sql-client.sh gateway -e 
> localhost:8083 {code}
>  # Observe network requests on every key press
>            Reporter: k walton
>            Priority: Major
>         Attachments: flink-sql-gateway-lag.mov
>
>
> When connecting to a remote gateway with the Flink SQL REPL we have noticed 
> that a network request is made for every key press. This makes the REPL 
> terminal unusably lagging when typing text into it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to