Skip to content
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

消息的调用方法,使用反射会有性能问题吗? #3

Closed
15951836388 opened this issue Jul 12, 2019 · 4 comments
Closed

消息的调用方法,使用反射会有性能问题吗? #3

15951836388 opened this issue Jul 12, 2019 · 4 comments

Comments

@15951836388
Copy link

看了代码,消息的调用是用反射来实现的,不用手动一条一条的注册调用方法,很方便。

反射调用方法和普通调用方法的性能相差多少?

@zllangct
Copy link
Owner

使用反射性能折扣是必然的,反射也有很多种,这里的性能折扣比较小,性能不是问题

@zllangct
Copy link
Owner

zllangct commented Jul 12, 2019

消息的主要消耗,在消息的反序列化,反射带来的这个性能消耗是九牛一毛,分布式的情况下,增加物理机的收益更大。

@15951836388
Copy link
Author

好的,谢谢。有考虑过客户端和服务器之间也用grpc吗?

@zllangct
Copy link
Owner

zllangct commented Jul 12, 2019

不现实,rpc不是这么用的~这是个误区,你要实现客户端和服务端同步调用的功能,其实在客户端封装一下就好,直接使用grpc的话,首先这个性能差很多,另外安全也是个大问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants