Parallel get extended field definitions
coolbeevip opened this issue · 0 comments
coolbeevip commented
I want to suggest an idea and checked that ...
- ... to my best knowledge, my idea wouldn't break something for other users
- ... the documentation does not mention anything about my idea
- ... there are no open or closed issues that are related to my idea
Description
I have a big project that contains the too many graphqls, SchemaClassScanner takes 5 minutes to execute
Use Cases
I added some logs in method scanForClasses,This is my log output
SchemaClassScanner.kt:84 - Schema scan discover Query field 5611, time elapsed 83960ms
SchemaClassScanner.kt:85 - Schema scan discover Mutation...
SchemaClassScanner.kt:88 - Schema scan discover Mutation field 16461, time elapsed 218258ms
SchemaClassScanner.kt:89 - Schema scan discover Subscription...
SchemaClassScanner.kt:92 - Schema scan discover Subscription field 0, time elapsed 0ms
SchemaClassScanner.kt:94 - Schema scan Queue
SchemaClassScanner.kt:108 - Schema scan Queue time elapsed 4470ms
I tried to solve this problem using parallel stream
- modify the line to
type.getExtendedFieldDefinitions(extensionDefinitions).parallelStream().forEach { field ->
- modify the line to
private val queue = Collections.synchronizedSet(linkedSetOf<QueueItem>())
The performance has been improved after the modification
Schema scan discover Query...
Schema scan discover Query field 5611, time elapsed 27539ms
SchemaClassScanner.kt:86 - Schema scan discover Mutation...
Schema scan discover Mutation field 16461, time elapsed 69114ms
Schema scan discover Subscription...
Schema scan discover Subscription field 0, time elapsed 0ms
SchemaClassScanner.kt:109 - Schema scan Queue time elapsed 4403ms
But, I failed to startup, and I found a lot of the following information in the log
Schema type was defined but can never be accessed, and can be safely deleted: XXX
...
Resolver was provided but no methods on it were used in data fetchers and can be safely deleted: XXX
...
I just want to improve the startup speed, what do you any suggestions?