Coder Social home page Coder Social logo

Use a NIO framework about babbler HOT 11 CLOSED

sco0ter avatar sco0ter commented on August 21, 2024
Use a NIO framework

from babbler.

Comments (11)

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


What would be the benefits? I don't use it because I am not familiar with them and I want to keep this library lighweight. Java's Socket is perfectly fine I think.
AFAIK those frameworks are useful for server architectures, which need to handle several thousand connections, but this scenario is unlikely for a client.
Also, non-blocking IO would likely increase the complexity.

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Julien Herr (Bitbucket: [Julien Herr](https://bitbucket.org/Julien Herr), ).


Yes, I understand the lighweight argument.

And you right about the server needs too. But does it mean it won't be a "good" idea to build a XMPP server or proxy (from/to another protocol by example) with babbler?

The most benefits I see for this kind of framework is to use non-blocking IO without "complexity". But I'm not enough familiar with them to determine if it could be a good or bad idea (that's why I asked).

FYI, Async-http-client is a http client which has an netty and grizzly implementation (but right, its main goal is to be async).

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


It's not intentend to act as a server or proxy, it's only a client library.
Theoretically you could use the xmpp-core project and build your own server/proxy, I guess.

It has only the "model" classes, which are mapped to XML and which are shared between server and client, e.g. Message, Presence, ...

The whole business logic needed for a server is not part of this project, though.

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Julien Herr (Bitbucket: [Julien Herr](https://bitbucket.org/Julien Herr), ).


Ok! If I understand well there is no use case where a "client" will be connected to multiple servers?

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


You can do that of course. E.g. Adium client allows for multiple concurrent accounts. But the amount of concurrent sessions is usually only a few, if at all.
In this case you can connect each session in its own thread.
I can only hardly imagine a client, which wants to manage thousands of concurrent connections to different servers.
The connect() and login() methods are blocking methods anyway. Doing this asynchronously would mean a lot of work, a whole new concept and probably also a lot of more complexity to the user of these methods.

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Julien Herr (Bitbucket: [Julien Herr](https://bitbucket.org/Julien Herr), ).


So, it seems my idea wasn't so good after all! Just a sledge hammer to kill a ant :p

Thank for you feedback :)

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


Maybe one day, far in the future, we can reconsider this ;-)

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


I told you, maybe one day this issue will be reconsidered.

After 3 years, that day has finally come!

Implementing NIO support was a lot of work, but I finally did it:
a9ce40d (among many other commits).

There will be a new connection method using NIO (Netty) starting with version 0.8.0.

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Julien HERR (Bitbucket: [Julien HERR](https://bitbucket.org/Julien HERR), ).


I'm not playing with xmpp anymore but it's awesome!!! Great job :)

Did you show perf improvments?

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


I didn't do real performance tests. I've created 100 concurrent sessions with blocking and non-blocking IO and stopped the time, but both approaches performed very similar.
That doesn't surprise me, afaik NIO doesn't perform faster, it just safes resources (threads).

from babbler.

sco0ter avatar sco0ter commented on August 21, 2024

Original comment by Christian Schudt (Bitbucket: sco0ter, GitHub: sco0ter).


A Netty implementation is available since 0.8.0

from babbler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.