gortiz commented on code in PR #14226: URL: https://github.com/apache/pinot/pull/14226#discussion_r1808405754
########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java: ########## @@ -145,6 +148,16 @@ public BrokerResponse handleRequest(JsonNode request, @Nullable SqlNodeAndOption } } + // check app qps before doing anything + String application = sqlNodeAndOptions.getOptions().get(Broker.Request.QueryOptionKey.APPLICATION_NAME); + if (application != null && !_queryQuotaManager.acquireApplication(application)) { + String errorMessage = + String.format("Request %d: %s exceeds query quota for application: %s", requestId, query, application); Review Comment: I find quite easier to read a string built with `+` than String.format or StringBuilder. And in terms of performance String.format is orders of magnitude worse given it needs to parse the string, find all the special arguments like %d or %s. Then it needs to process them (understand that %d and %s are different) and then it needs to allocate an Object[] to store requestId, query and application (which hopefully should be optimized by JIT, but we cannot be sure). It is not that in this case performance actually matters, but unless we need to apply some custom format (ie using exponential annotation) it is never worth to use String.format. Even if it is used somewhere else, we should reduce it usage instead of extending it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org