jhunters / jprotobuf

A useful utility library for java programmer using google protobuf
Apache License 2.0
879 stars 281 forks source link

ProtobufProxy.create 在高并发的情况下会Block线程 #195

Closed Dr-Shiki closed 1 year ago

Dr-Shiki commented 1 year ago

看起来在单机高QPS的情况下 调用ProtobufProxy.create (xxx.class)的情况下 会有大量线程block在其中的JDKCompiler.doCompile方法。有什么办法可以优化一下么

jhunters commented 1 year ago

doCompile 的性能是会比较慢,虽然加了缓存。 你可以考虑用 预编译的方式,在打包时把编译工作先处理了

Imgaojp commented 1 year ago

我们的做法是在启动后,应用正式接入流量前预热,在请求来之前先ProtobufProxy.create (xxx.class)

jhunters commented 1 year ago

也可以用 预编译的方式,预编译插件 配置 https:github.com/jhunters/jprotobuf/blob/master/Document.md