Skip to content

MimeType.checkParameters() high processing time #25479

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
arajitsamanta opened this issue Jul 27, 2020 · 12 comments
Closed

MimeType.checkParameters() high processing time #25479

arajitsamanta opened this issue Jul 27, 2020 · 12 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@arajitsamanta
Copy link

arajitsamanta commented Jul 27, 2020

Affects:
Spring Boot 2.0.1 RELEASE, Spring Framework 5.0.5 RELEASE

Issue Description:
In a highly concurrent environment(Average 20K transaction per minute) it was observed that 100% of the processing time is being taken by MimeType.checkParameters()

Attached screenshot of the dynatrace

Wondering if this is something related to #25043 / #24886.

Any solution/suggestion would be helpful


@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 27, 2020
@quaff
Copy link
Contributor

quaff commented Jul 28, 2020

Please try latest 5.2.8.RELEASE.

@bclozel
Copy link
Member

bclozel commented Jul 28, 2020

I don't see a screenshot attached to your bug report. We've made significant performance improvements in the latest releases in this space.

Is the behavior you're seeing unusual? With which Spring Framework version this was behaving as expected?

I don't this this is related to the issues you're pointing to since the changes were introduced in Spring Framework 5.2 with #22340.

Maybe the media types used by your application (or sent by the clients) are a bit unusual and could explain this performance issue?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Jul 28, 2020
@arajitsamanta
Copy link
Author

@bclozel Please see below

Spring Version
Spring Boot 2.0.1 RELEASE, Spring Framework 5.0.5 RELEASE

Content Type Headers
Content Type: application/json
Accept: text/html, image/gif,image/jpeg, *;q=.2, / ; q=.2;

Dynatrace Screenshot
Spring Issue_Bug

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 28, 2020
@bclozel
Copy link
Member

bclozel commented Jul 28, 2020

Is the behavior you're seeing unusual? With which Spring Framework version this was behaving as expected?

Could you answer this question as well?
The call stack we're seeing here is not unusual. We've made performance improvements in recent versions about that, but I don't remember a change there around this version.

@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 28, 2020
@arajitsamanta
Copy link
Author

arajitsamanta commented Jul 28, 2020

@bclozel
I have not tried with any other version of either spring boot or spring framework as that requires lot of change. First i want to understand why this is happening and if this is expected behavior.

We have been observing higher percentage(>50%) of contribution of that particular method call towards overall processing time. Lets say overall processing time is 1 sec for a single request. More than 50% being spent on that method invocation which seems to be very unusual.

Is that something expected with spring 5.0.5 version ? IS the solution is to only upgrade to latest spring versions?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 28, 2020
@bclozel
Copy link
Member

bclozel commented Jul 28, 2020

It all depends on the actual processing time of such requests - if it's really short, let's say a few milliseconds, then it might not be unexpected.

As I've said earlier, we've made significant improvements in recent versions in that area - improvements that we cannot backport in earlier versions for stability reasons. Without knowing where to look for, especially in which version this performance problem appeared, I cannot really make progress on this issue: I would just go down the path I've already worked on, which is caching the parsing of media types.

Ideally, changing the Spring Framework version (changing dependency version or going back into your project's history) and and checking whether the problem is still there would help narrowing down the problem. Better, maybe you can reproduce this performance problem on a new sample project?

The problem is that at this point we don't even know if this behavior was there to begin with, hence why the performance work we did recently - or if there's an unrelated change in the 5.0.x line.

@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 28, 2020
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Aug 4, 2020
@arajitsamanta
Copy link
Author

I tried to re-produce but not being able to. This issue can be closed for now.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Aug 5, 2020
@bclozel
Copy link
Member

bclozel commented Aug 5, 2020

Thanks for checking!

@bclozel bclozel closed this as completed Aug 5, 2020
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 5, 2020
@HaleLu
Copy link

HaleLu commented Dec 2, 2020

I think I found out the truth. It's a bug in jdk.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8137184

else if (this.queue.remove(key)) {
	this.queue.add(key);
	return this.cache.get(key);
}

Calling ConcurrentLinkedQueue#remove in parallel will cause memory leaks

@bclozel
Copy link
Member

bclozel commented Dec 2, 2020

@HaleLu it's been fixed and released with a bunch of JDK versions. Unless you're running an old JDK this shouldn't be a problem. See https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8054446

@HaleLu
Copy link

HaleLu commented Dec 4, 2020

@bclozel i know. I just want to explain why this is happening for @arajitsamanta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants