Skip to content

CQL retrieval in QueryExtractorDelegate is CPU-intensive #1186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zhou-hao opened this issue Oct 25, 2021 · 4 comments
Closed

CQL retrieval in QueryExtractorDelegate is CPU-intensive #1186

zhou-hao opened this issue Oct 25, 2021 · 4 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@zhou-hao
Copy link

image

the getSql method execute every time.

return createFlux(action).onErrorMap(translateException("ReactiveSessionCallback", getCql(action)));

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 25, 2021
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 25, 2021
@mp911de
Copy link
Member

mp911de commented Oct 25, 2021

Thanks for reporting the issue. We should use simple concatenation to avoid excessive formatting overhead on unknown statement types. Care to provide what type of Statement you're using? Maybe that's something we should consider additionally?

@mp911de mp911de self-assigned this Oct 25, 2021
@mp911de mp911de changed the title ReactiveCqlTemplate performance issues ? CQL retrieval in ReactiveCqlTemplate is CPU-intensive Oct 25, 2021
@mp911de mp911de changed the title CQL retrieval in ReactiveCqlTemplate is CPU-intensive CQL retrieval in QueryExtractorDelegate is CPU-intensive Oct 25, 2021
@mp911de mp911de added this to the 3.2.7 (2021.0.7) milestone Oct 25, 2021
mp911de added a commit that referenced this issue Oct 25, 2021
Consistently use toCql(…) and String.format for CQL retrieval.

See #1186
mp911de added a commit that referenced this issue Oct 25, 2021
…format(…).

We now use string concatenation during query extraction to avoid String.format(…) overhead for unknown queries.

Closes #1186
mp911de added a commit that referenced this issue Oct 25, 2021
Consistently use toCql(…) and String.format for CQL retrieval.

See #1186
@zhou-hao
Copy link
Author

public <T> Flux<T> execute(ReactiveSessionCallback<T> action) throws DataAccessException {
Assert.notNull(action, "Callback object must not be null");
return createFlux(action).onErrorMap(translateException("ReactiveSessionCallback", getCql(action)));
}

The action parameter is a lambda expression, so ...

@mp911de
Copy link
Member

mp911de commented Oct 25, 2021

It would make sense to replace the getEffectiveFetchSize(…) lambda with a proper class. Beyond that, if your ReactiveSessionCallback implements CqlProvider, then CQL extraction for the action would work as well.

mp911de added a commit that referenced this issue Oct 25, 2021
We now use nested classes implementing CqlProvider to retrieve the fetch size in session callbacks. This enables CQL retrieval. Previously, CQL retrieval saw a class that didn't implement CqlProvider and reported therefore unknown CQL.

See #1186
mp911de added a commit that referenced this issue Oct 25, 2021
We now use nested classes implementing CqlProvider to retrieve the fetch size in session callbacks. This enables CQL retrieval. Previously, CQL retrieval saw a class that didn't implement CqlProvider and reported therefore unknown CQL.

See #1186
@zhou-hao
Copy link
Author

ok,thanks!!

mp911de added a commit that referenced this issue Oct 25, 2021
We now use nested classes implementing CqlProvider to retrieve the fetch size in session callbacks. This enables CQL retrieval. Previously, CQL retrieval saw a class that didn't implement CqlProvider and reported therefore unknown CQL.

See #1186
mp911de added a commit that referenced this issue Oct 25, 2021
We now use nested classes implementing CqlProvider to retrieve the fetch size in session callbacks. This enables CQL retrieval. Previously, CQL retrieval saw a class that didn't implement CqlProvider and reported therefore unknown CQL.

See #1186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants