Skip to content

Annotated method argument matching performance issue [SPR-15060] #19626

Closed
@spring-projects-issues

Description

@spring-projects-issues

Gary Russell opened SPR-15060 and commented

Possibly related to #19496

@SpringBootApplication
public class So41346616Application {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(So41346616Application.class, args);
		MessageChannel annotated = context.getBean("annotated", MessageChannel.class);
		MessageChannel notAnnotated = context.getBean("notAnnotated", MessageChannel.class);
		Message<?> foo = new GenericMessage<>("foo");
		StopWatch watch = new StopWatch();
		watch.start();
		for (int i = 0; i < 10000; i++) {
			annotated.send(foo);
		}
		watch.stop();
		watch.start();
		for (int i = 0; i < 10000; i++) {
			notAnnotated.send(foo);
		}
		watch.stop();
		watch.start();
		for (int i = 0; i < 10000; i++) {
			annotated.send(foo);
		}
		watch.stop();
		System.out.println("Annotated: " + watch.getTaskInfo()[0].getTimeMillis() +
				" not: " + watch.getTaskInfo()[1].getTimeMillis() +
				" second annotated: " + watch.getTaskInfo()[2].getTimeMillis());
		context.close();
	}

	@ServiceActivator(inputChannel = "annotated")
	public void with(@Payload String payload) {
	}

	@ServiceActivator(inputChannel = "notAnnotated")
	public void without(String payload) {
	}

}

Annotated: 3521 not: 36 second annotated: 11202

Yourkit pointed me to ConcurrentReferenceHashMap and we're getting cache misses and adding new entries for each invocation.


Affects: 4.3.5

Reference URL: http://stackoverflow.com/questions/41346616/spring-boot-starter-integration-1-4-3-performance-degradation

Attachments:

Issue Links:

Referenced from: commits e38c020, 794580f

3 votes, 9 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions