NettyRPC | high performance java rpc server base on Netty , using kryo | Websocket library

 by   tang-jie Java Version: Current License: Non-SPDX

kandi X-RAY | NettyRPC Summary

kandi X-RAY | NettyRPC Summary

NettyRPC is a Java library typically used in Networking, Websocket, Spring applications. NettyRPC has no bugs, it has no vulnerabilities, it has build file available and it has medium support. However NettyRPC has a Non-SPDX License. You can download it from GitHub.

NettyRPC is high performance java rpc server base on Netty,using kryo,hessian,protostuff support message serialization.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              NettyRPC has a medium active ecosystem.
              It has 1242 star(s) with 509 fork(s). There are 133 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 25 open issues and 2 have been closed. On average issues are closed in 2 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of NettyRPC is current.

            kandi-Quality Quality

              NettyRPC has 0 bugs and 0 code smells.

            kandi-Security Security

              NettyRPC has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              NettyRPC code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              NettyRPC has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              NettyRPC releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are available. Examples and code snippets are not available.
              NettyRPC saves you 3367 person hours of effort in developing the same functionality from scratch.
              It has 7221 lines of code, 753 functions and 207 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed NettyRPC and discovered the below as its top functions. This is intended to give you an instant insight into NettyRPC implemented functionality, and help decide if they suit your requirements.
            • Performs invoke
            • Reflector method implementation
            • Invokes the method
            • Invokes the method
            • Initialize module metrics
            • Gets the method signature of a class
            • Generate a string representation of the class
            • Query the database for a person
            • Query a collection of Person objects
            • Handle an attribute change event
            • Encodes a message
            • Handles an invocation request
            • Encode a message
            • Generate the proxy class
            • Encode the message to the output buffer
            • Invokes the ServiceFilter method
            • Parse a bean definition
            • Sleep duration time
            • Calculate duration time
            • Visit critical section
            • Inject the invoke method
            • Parses a bean definition
            • Start the server
            • Initialize module metrics
            • Decodes a message
            • Invokes the specified method on the specified source
            Get all kandi verified functions for this library.

            NettyRPC Key Features

            No Key Features are available at this moment for NettyRPC.

            NettyRPC Examples and Code Snippets

            No Code Snippets are available at this moment for NettyRPC.

            Community Discussions

            QUESTION

            Not able to connect to websocket using Nginx and Uvicorn
            Asked 2022-Mar-26 at 10:20

            I built a docker container with Django, Uvicorn, Nginx and Redis, and am using django-channels but when I run this it says it cannot connect to the websocket and this is seen in the browser console:

            WebSocket connection to 'ws://127.0.0.1:8080/ws/notifications/' failed

            It is working fine when I use Django's runserver command for development but when I include Nginx and Uvicorn it breaks.

            Entrypoint.sh:

            ...

            ANSWER

            Answered 2022-Mar-26 at 10:20

            As noted in a comment by Iain Shelvington, it seems like websockets are not included in the base install of uvicorn

            Source https://stackoverflow.com/questions/68828128

            QUESTION

            Symfony Doctrine EntityManager not refreshing properly
            Asked 2022-Mar-14 at 13:18

            I have a ratchet WebSocket server, whose entityManager is initialized from the backend. However, if some changes happen from one of the front-ends since the state of the entityManager of the WebSocket server is different from the backend, the new changes are not reflected in the data that is served by the WebSocket server.

            For this purpose, I wrote some listeners on the backend that listen for changes in these entities in and then send a request to the server like so:

            ...

            ANSWER

            Answered 2022-Mar-08 at 15:30

            Doctrine uses the identity map

            The websocket server is a daemon and all cleanup tasks are the responsibility of the developer

            Use

            \Doctrine\ORM\EntityManager::find with the $lockMode argument = \Doctrine\DBAL\LockMode::NONE

            OR

            Call the \Doctrine\ORM\EntityManager::clean method before \Doctrine\ORM\EntityManager::find

            Source https://stackoverflow.com/questions/71337399

            QUESTION

            SignalR CORS issue with Angular and .NET Core
            Asked 2022-Mar-10 at 08:45

            I know there are a lot of questions and answeres regarding this topic out there, but nothing matched my specific issue.

            I am using the following versions

            • Angular 10.0.14
              • @aspnet/signalr 1.0.27
            • ASP.NET Core 3.1

            VERSION UPDATE:

            • I just replaced @aspnet/signalr 1.0.27 by @microsoft/signalr 5.0.11 -> same issue.

            The SignalR connection works pretty fine until I add an accessTokenFactory in the Angular frontend.

            Frontend

            ...

            ANSWER

            Answered 2021-Oct-19 at 12:06

            Browsers do not support headers for websockets, therefore the bearer token has to be added as query string parameter. We hit the maximum length for URLs due to the length of our bearer token. We could shorten our token or use a reference token, see also: https://github.com/aspnet/SignalR/issues/1266

            Hope this helps others as well.

            Source https://stackoverflow.com/questions/69628049

            QUESTION

            .NET 6.0: new Blazor project throws Websocket error
            Asked 2022-Feb-26 at 12:07

            I am running currently a webserver with ASP.NET Core 3.1 and a Blazor project. Recently when upgrading to .NET 6.0 I encountered (even with a blank Blazor project) some problems with a websocket error message in the browser only when deployed on my webserver (see message below).

            Locally (on Windows 11 x64, VS 22 Preview 4) there are no error messages...

            Webserver: Debian 10 x64, .NET 6.0 SDK installed, running on NGINX with websockets enabled (reverse proxy).

            Do I miss out on something or is it a problem with the current state of .NET 6.0 and NGINX? I already tried to access the webpage locally on the debian server and the same error message occurs.

            Help would be much appreciated!

            Greetings!

            Error messages within order:

            ...

            ANSWER

            Answered 2022-Feb-26 at 12:07

            Here is the solution described again, maybe a little bit more convenient:

            To fix this problem, I changed in the site-configuration (/etc/nginx/sites-available) of nginx the following variables:

            Source https://stackoverflow.com/questions/70937709

            QUESTION

            WebSocket not working when trying to send generated answer by keras
            Asked 2022-Feb-17 at 12:52

            I am implementing a simple chatbot using keras and WebSockets. I now have a model that can make a prediction about the user input and send the according answer.

            When I do it through command line it works fine, however when I try to send the answer through my WebSocket, the WebSocket doesn't even start anymore.

            Here is my working WebSocket code:

            ...

            ANSWER

            Answered 2022-Feb-16 at 19:53

            There is no problem with your websocket route. Could you please share how you are triggering this route? Websocket is a different protocol and I'm suspecting that you are using a HTTP client to test websocket. For example in Postman:

            Postman New Screen

            HTTP requests are different than websocket requests. So, you should use appropriate client to test websocket.

            Source https://stackoverflow.com/questions/71099818

            QUESTION

            no affect on CORS enabling with NESTJS
            Asked 2022-Jan-31 at 21:31

            I fail to enable the CORS for testing with the latest NestJS 8.0.6 and a fresh http + ws project. That said, I want to see the Access-Control-Allow-Origin in the servers response (so that the client would accept it). Here is my main.ts where I've tried 3 approches: 1) with options, 2) with a method, 3) with app.use. None of them works.

            ...

            ANSWER

            Answered 2021-Sep-20 at 20:29

            The enableCors and { cors: true } options are for the HTTP server (express or fastify). The URL given showing the CORS error came from a socket.io connection. To enable CORS for socket.io you need to use the options in the @WebsocketGateway() decorator, like

            Source https://stackoverflow.com/questions/69259893

            QUESTION

            How to give certificate to Java Websocket?
            Asked 2022-Jan-20 at 10:33

            Forgive me for the newb question, but I am confused and obviously not understanding the fundamentals or explanations of how to use a Websocket server hosted over HTTPS. Everything I find online leads me to have more questions than answers.

            I have a Websocket server hosted on my HTTPS website using Java code.

            This is my WebsocketServer.java file:

            ...

            ANSWER

            Answered 2022-Jan-13 at 14:50

            Keep it easy.
            Certs inside your application are complex - they are hard to manage and you will get problems to run your application in a modern cloud environment (start new environments, renew certs, scale your application, ...).

            Simple conclusion: Dont implement any certs.

            How-to get encrypted connections?

            As Mike already pointed out in the comments: WebSockets are just upgraded HTTP(S) connections. A normal webserver (nginx, apache) takes care about the certs. It can be done in kubernetes (as ingress-controller) or with a "bare-metal" webserver.
            Both of them should act as a reverse-proxy. This means: Your java-application doesn't know anything about certs. It has just unencrypted connections - like in your code on port 6868.
            But the client will not use this port. 6868 is only internally reachable.

            The client will call your reverse-proxy at the normal HTTPS port (=443). The reverse-proxy will forward the connection to your java-application.

            Here some links for further information:

            Source https://stackoverflow.com/questions/70654559

            QUESTION

            Push local WebRTC stream to a NodeJS server in the cloud
            Asked 2021-Dec-16 at 06:33

            I have a task, but I can't seem to get it done. I've created a very simple WebRTC stream on a Raspberry Pi which will function as a videochat-camera. With ionic I made a simple mobile application which can display my WebRTC stream when the phone is connected to the same network. This all works.

            So right now I have my own local stream which shows on my app. I now want to be able to broadcast this stream from my phone to a live server, so other people can spectate it.

            I know how to create a NodeJS server which deploys my webcam with the 'getUserMedia' function. But I want to 'push' my WebRTC stream to a live server so I can retrieve a public URL for it.

            Is there a way to push my local Websocket to a live environment? I'm using a local RTCPeerConnection to create a MediaStream object

            ...

            ANSWER

            Answered 2021-Dec-10 at 16:54

            Is there a way to push my local Websocket to a live environment?

            It's not straightforward because you need more than vanilla webrtc (which is peer-to-peer). What you want is an SFU. Take a look at mediasoup.

            To realize why this is needed think about how the webrtc connection is established in your current app. It's a negotiation between two parties (facilitated by a signaling server). In order to turn this into a multi-cast setup you will need a proxy of sorts that then establishes separate peer-to-peer connections to all senders and receivers.

            Source https://stackoverflow.com/questions/70260437

            QUESTION

            Intercept WebSocket messages
            Asked 2021-Dec-09 at 17:16

            With ajax requests it can be done with this code:

            ...

            ANSWER

            Answered 2021-Dec-09 at 17:16
            Intro

            The question/bounty/op is specifically asking for a reputable source. Instead of rolling a custom solution, my proposal is that a known proven library should be used - that has been used, audited, forked, and in general used by the community and that is hosted on github.

            The second option is to roll your own (though not recommended) and there are many exccelent answers on how to do it involving the addEventListener

            wshook

            Wshook is a library (hosted on github) that allows to easily intercept and modify WebSocket requests and message events. It has been starred and forked multiple times.

            Disclaimer: I don't have any relationship with the specific project.strong text

            Example:

            Source https://stackoverflow.com/questions/70205816

            QUESTION

            How many total TCP connections are created for web socket call from browser to apache http server to web service
            Asked 2021-Oct-18 at 14:57

            I would like to know how many TCP connections are created when WebSocket call is made from browser to apache http server to backend web service?

            Does it create a separate TCP connection from the browser to apache http server and from apache to the web service?

            ...

            ANSWER

            Answered 2021-Oct-18 at 14:57

            When Apache is proxying websockets, there is 1 TCP connection between the client and Apache and 1 TCP connection between Apache and the backend.

            Apache watches both connections for activity and forwards read from one onto the other.

            This is the only way it can be in a layer 7 (Application Layer, HTTP) proxy. Something tunnelling at a much lower layer, like a NAT device or MAC forwarding IP sprayer could tunnel a single connection -- but not on the basis of anything higher up in the stack like headers.

            The 2nd connection is observable with netstat.

            The 2nd connection is opened when mod_proxy_wstunnel calls ap_proxy_connect_to_backend() which calls apr_socket_create() which calls the portable socket() routine. When recent releases of mod_proxy_http handle this tunneling automatically, simialr flow through ap_proxy_acquire_connection.

            Source https://stackoverflow.com/questions/69496700

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install NettyRPC

            基于cglib生成异步代理Mock对象,针对一些极端耗时的RPC调用场景进行异步回调,从而提高客户端的并行吞吐量。
            接口能力展现功能模块部署在服务端的18886端口,可以在浏览器中输入:http://ip地址:18886/NettyRPC.html 进行查看。
            比如在浏览器的地址栏中输入:http://10.1.1.76:18886/NettyRPC.html, 可以查看NettyRPC服务器对外暴露的服务能力接口信息。
            NettyRPC客户端支持重连功能:这点主要是针对RPC服务器宕机的情形下,RPC客户端可以检测链路情况,如果链路不通,则自动重连(重连重试的时间默认为10s)。
            进一步合理地分配和利用服务端的系统资源,NettyRPC可以针对某些特定的RPC请求,进行过滤拦截。
            具体过滤器要实现:com.newlandframework.rpc.filter.Filter接口定义的方法。
            被拦截到的RPC请求,NettyRPC框架会抛出com.newlandframework.rpc.exception.RejectResponeException异常,可以根据需要进行捕获。
            spring配置文件中的nettyrpc:service标签,新增filter属性,用来定义这个服务对应的过滤器的实现。当然,filter属性是可选的。
            在之前的NettyRPC版本中,RPC服务端集成了一个功能:针对Java HotSpot虚拟机的热加载特性,可以动态加载、生成并执行客户端的热点代码。然而却有一定的风险。因为这些代码中的某些方法,可能存在一些危及服务端安全的操作,所以有必要对这些方法进行拦截控制。
            技术难点在于:如何对服务端生成的字节码文件进行渲染加工?以往传统的方式,都是基于类进行代理渲染,而这次是针对字节码文件进行织入渲染,最终把拦截方法织入原有的字节码文件中。
            对字节码操作可选的方案有Byte Code Engineering Library (BCEL)、ASM等。最终从执行性能上考虑,决定采用偏向底层的ASM,对字节码进行渲染织入增强,以节省性能开销。最终通过类加载器,重新把渲染后的字节码,载入运行时上下文环境。
            具体方法拦截器要实现:com.newlandframework.rpc.compiler.intercept.Interceptor接口定义的方法。NettyRPC框架提供了一个简易的拦截器实现:SimpleMethodInterceptor,可以在这里加入你的拦截判断逻辑。
            是否开启JMX监控,可以通过环境变量:nettyrpc.jmx.invoke.metrics来控制(为0表示关闭JMX监控;非0表示打开JMX监控)。对应NettyRPC系统变量为:RpcSystemConfig.SYSTEM_PROPERTY_JMX_INVOKE_METRICS。如果开启JMX监控,启动的时候,控制台上会打印JMX URL信息。
            JMX监控的URL地址格式为:service:jmx:rmi:///jndi/rmi://服务器ip地址:1098/NettyRPCServer。比如:service:jmx:rmi:///jndi/rmi://10.1.8.5:1098/NettyRPCServer,然后可以在jconsole中,通过JMX对NettyRPC服务端的调用情况进行监控。
            目前服务端监控的维度主要有:调用次数、调用成功次数、调用失败次数、过滤拦截次数、调用时长、调用最大时长、调用最小时长、错误明细、最后一次错误发生的时间、调用时长统计数组区间。
            目前暂时只支持jconsole方式,后续会考虑在NettyRPC内部架设HTTP服务器,以网页的形式直观地展示监控数据信息。
            为了提高JMX数据统计监控的精度,服务端采用了临界区对RPC请求进行隔离。但是如果客户端是通过AsyncInvoker异步调用的方式进行RPC请求的话,则会把异步并行加载强制转成异步串行加载。这并不是我们希望看到的。
            后续会针对异步并行加载串行化的问题,在服务端采用哈希队列的方式隔离管理临界区对象,减少JMX监控对异步调用的侵蚀影响。
            哈希分片加锁算法,采用空间换时间策略。其主要思路参考借鉴了JDK中ConcurrentHashMap的实现,经过优化之后,NettyRPC的JMX监控统计性能会有很大的提升。
            哈希分片加锁算法中,哈希分片的个数,通过环境变量nettyrpc.jmx.metrics.hash.nums进行设定,默认为8个哈希桶。当然,你可以改成其它大于1的整数,数值越大,哈希冲突越小,JMX监控的性能越好,但是代价是,JVM堆内存空间有所损耗。
            经过哈希分片加锁算法优化之后,特别是对异步并行调用(AsyncInvoker)的侵蚀大幅度降低,对整个NettyRPC系统而言,统计性能也有质的提升。一方面不影响原有系统的调用吞吐量,另外一方面也不会降低JMX的统计精度。
            默认加锁采用非公平锁,你可以通过设置环境变量nettyrpc.jmx.metrics.lock.fair为1,改成公平锁。在高并发调用的场景,建议采用非公平锁。
            利用JMX接口,从NettyRPC服务端获取模块调用的监控数据。
            在环境变量nettyrpc.jmx.invoke.metrics为1的前提下,在浏览器输入URL:http://ip地址:18886/NettyRPC.html/metrics。 即可查看NettyRPC系统模块间的调用统计情况。
            可以按F5刷新统计界面,查看最新的统计指标。
            通过监听器链和过滤器链,可以对RPC客户端请求进行过滤和监听。具体参考NettyRPC入门手册中的“RPC请求链式处理”章节。
            过滤器链封装类(com.newlandframework.rpc.filter.ModuleFilterChainWrapper)、监听器链封装类(com.newlandframework.rpc.listener.ModuleListenerChainWrapper)通过spring依赖注入。
            NettyRPC内置了一些链式过滤器:com.newlandframework.rpc.filter.support.ClassLoaderChainFilter、com.newlandframework.rpc.filter.support.EchoChainFilter,以及链式监听器:com.newlandframework.rpc.listener.support.ModuleListenerAdapter。具体可以根据需求进行扩展添加。

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/tang-jie/NettyRPC.git

          • CLI

            gh repo clone tang-jie/NettyRPC

          • sshUrl

            git@github.com:tang-jie/NettyRPC.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Websocket Libraries

            netty

            by netty

            ws

            by websockets

            websocket

            by gorilla

            websocketd

            by joewalnes

            koel

            by koel

            Try Top Libraries by tang-jie

            AvatarMQ

            by tang-jieJava

            NettyGateway

            by tang-jieJava

            BeanUtilsAssist

            by tang-jieJava