sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.82k stars 1.17k forks source link

可否增加一个配置功能, 在初始化sofa rpc过程中主动扫描扩展点 #1199

Closed WindySummerF closed 2 years ago

WindySummerF commented 2 years ago

Your question

可否增加一个配置功能, 在初始化sofa rpc过程中主动扫描扩展点, 主动将响应的类加载到内存中? 这样可以保证第一次调用流程避免因为加载类导致耗时过长.

Your scenes

如果没有自动加载这些类, 第一次调用RPC服务耗时会明显增加. 通过jProfiler检测, 发现明显第一次调用RPC的时候JVM内的类会增加大约2000个左右, 在我本地机器, 这个加载过程会耗时大约200ms (我本地RPC测试环境没有开启连接懒加载, 所以第一次调用之前TCP连接应该就已经建立好了, 这200ms中应该不包含建立连接时间)

VPOxccG1PR

Your advice

增加一个配置, 如果改配置打开, 则在初始化过程中直接扫描扩展点并将涉及到的类加载到JVM中. 第一次调用时不会因为加载类二耗时过长.

Environment

JervyShi commented 2 years ago

@WindySummerF Interested in submitting a PR for this function?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.