Giter Club home page Giter Club logo

libunicorn's Introduction

Ají

Ají is Jolokia UI which contains a Dashboard with various textual and graphical widgets and an MBean Browser for an easy exploration of the JMX space. It is an add-on to the normal Jolokia agents and gets deployed along with it.

Well, this is how it will look like. At the moment there is not much here and we are still in the design phase. In this README you will find a description of the planned tech stack, description of the use cases to be implemented, a rough roadmap and some ideas for future versions. And how you can participate:

Join Us!

This project is open. Since there is not much yet here, so it is a good chance to dig into. The only requirement is a decent knowledge of Javascript (which goes beyond spicing up web sites). We start with Fork + Pull Model and will continue to a mixed Fork + Pull / Shared Repository Model where a small team will do the integration in the shared repository.

Development is coordinated over two channels:

  • A mailing-list [email protected]. Please use Google Groups for subscribing.
  • A scrum based task distribution with help of Ají's JIRA. The current planned stories and task can be found in the planning board.
  • Use IRC channel #jolokia for live discussions on Freenode

High Level Design Goals

This list of a high level goals serve as guideline for the overall development. These are not connected to a particular use case, but always part of the acceptance criteria of each user story

  • Self contained - it is essential, that Ají gets deployed along with the Jolokia agent it uses as backend. This implies that there will be 4 variants, each for each Jolokia agent variant.
  • Small - Ají + Jolokia <= 350k.
  • Fast - The performance of Ají depends on various factors like the client side javascript execution or the number of server side interaction. Performance tests should backup performance thresholds.
  • Good UX - A focus should be on keyboard navigation, appropriate (and maybe innovative) UI elements and an overall good user experience. Difficult.
  • Beautiful - it should look good. This means there should be put efforts into the choice of things like fonts, spacing, UI element arrangements, fluid behaviour.

Use Cases

The first two use cases we want to cover is a Dashboard and a MBean Browser.

Dashboard

The Dashboard provides timeseries chart and other widget which can be grouped in various sections. There are widget that came out of the box (Memory usage, thread count), application server specific widgets and others can be defined by the user. The user can arrange the widgets freely on the dashboard and the configuration is saved locally in the browser

Ají Dashboard

See AJI-3 for details.

MBean Browser

The MBean Browser allows for easy navigation to an MBean and applying certain actions like reading/writing of attributes or execution of operations. Keyboard navigation is easily possible.

See AJI-1 for details.

Additional Ideas

  • Plugin architecture
  • Development Tools
    • Thread Dump Analysis
    • Memory Analysis
  • App-Server specific views

Tech Stack

Ají is also a playground project for having fun with the latest stuff, even when it is not matured. That's our fun part ;-). Also, browser compatibility is not a main goal and Ají will require decent HTML-5 capabilities.

Armed with this freedom, and after quite some time of research and evaluation the following tech stack settled won, although nothing is really fixed while we are going.

As already said, Ají will be a SPA (single page application) with no logic on the server side and everything running on the client. The Jolikia agent is the server part (with maybe some slight addition for supporting some use cases).

Here now the proposed stack. It is not really settled down, maybe you have some strong opinions here ? Let us know at [email protected].

Coffeescript

I tried it and I like it. My only concerns where about an extended round-trip due to the extra compilation step and debugging hurdles for correlating back to the CS source. The former can be avoided by a proper build process and workflow (see below), the later is (currently) a non-issue since it is really straightforward from the generated JS code to the original CS code.

Build system

A build system has to be really important to carefully be chosen since it completely dominates the development workflow and overall development experience. I considered Gradle, but this was really to different from my old love-hate, Maven. I feel to uncoformtable to make the switch now (although I will try graddle sometimes), especially since, I found a Maven setup for a development workflow without an explicite build step: Save CoffeeScript source (or let it automatically save by a decent IDE), reload browser. This works even over module and project boundaries (e.g. the Jolokia javascript sources can used the same way although sitting in a completely different project).

An initial example is checked in:

$ cd aji/war $ mvn jetty:run ..... [other terminal:] $ cd aji/war $ mvn brew:compile -Dbrew.watch=true ..... [other terminal:] $ vi aji/war/src/main/coffeescript/aji/jolokia.coffee [edit and save] [watch output on terminals] [reload http://localhost:8080/aji/app/index.html or so]

The main ingredients are a Maven Jetty Plugin with customized contextHandler configuration an the Brew Plugin for compiling Cofeescript source. The later includes also a watch mode for periodically checking the CoffeeScript source.

MVC Platform

Several JS MVC platform has been checked briefly (see this overview for a summary) and the current favourite is still backbone.js for the following reasons:

  • Seems to have the largest momemtum
  • Small enough
  • Sufficient for our needs

An alternative would be spine.js.

Whether Ají requires an additional layer as application framework on top of backbone.js has not yet been evaluated: Thorax, Marionette and Chaplin. On a first view, Chaplin seems to be quite charming.

Module Management

Something really missing out of the box for (the current) Javascript is a module system like for other languages. This lack really made me the largest headache coming from an non Javascript background used to work with cool systems like OSGi. But happily there are solutions. For the browser RequireJS is the de facto AMD loader. However, the tendency at the moment goes to curl.js because it seems to be quite smaller, it is supossed to be faster and has a very nice API. Although, there is some ecosystem around it (cujo) which could be helpful as well.

Layout and UI

Everybody uses Bootstrap these days, there even already quite some additions to the hype. Since I'm not a design expert (although I highly appreciate good design), we will go this road as well with appropriate adoption (there must be a chili somewhere ;-). This implies that we will use Less as well, which a good thing on its own.

Charting

There are tons of charting libraries out there. However, most of them have memory issues if the charts are updated periodically (which is the common use case for us). That is the major reason, why Tomasz Nurkiewicz has chosen Highcharts as charting library for its Jolokia Dashboard Sample. However, HighCharts is not free and not compatible to an Apache License, so that it is not suitable for our purposes where we have to package and distribute the charting library along with the agent.

Another nice approach for modern browsers is to use SVG based charting (instead of canvas based one). Here, d3.js is an outstanding support library, however it is rather low-level.

In order to let the door open for various graphing library some sort of abstraction bei an plugin API would be nice as described here

Local storage / IndexedDB

Since server side persistence is not yet in focus, for persistence needs like the dashboard configuration HTML-5 client side storage should be used. The first option should be IndexedDB with an fallback to LocalStorage and cookies. Why IndexedDB should be the first choice is laid out in this post whose arguments I can follow.

libunicorn's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

libunicorn's Issues

Adjust hook calling convention.

An array of string parameters is well-suited for IRC, but void pointers or an array of void pointers is much more flexible.

Add 512-byte buffer to irc_message_t

Buffering is a mess right now. It's easy to forget that code modifies and references a specific character buffer rather than copying data somewhere else in memory. This means that character buffers cannot be reused while an irc_message_t is still understood to be valid. In addition, the behavior of calling irc_message_format() with the same character buffer as is being used for the irc_message_t is too dependent on the inner workings of irc_message_format() for any sort of standard expected result to be determined. Typical use of the message API results in one character buffer being allocated for each message.

This fix will officialize the "one buffer per irc_message_t" design and hopefully result in cleaner and simpler code when using the message API.

Peer tracking

Functionality to keep track of other users on the network. This includes nicknames, away statuses, and the channels they are in. This should reduce the amount of memory used by the channel tracking system.

005 ISUPPORT Parsing

Add functions to parse the 005 numeric (ISUPPORT) into an easily-usable data structure for clients.

The hardest thing to determine will how best to store the data. One solution might be to store the data in some sort of associative array, but as the same kinds of data will be stored over and over again, it might be better to store it in a struct containing fields for each possible ISUPPORT field.

My current thought is to cherry-pick ISUPPORT fields that will be important to nearly every IRC client, while ignoring the more obscure or less useful fields. The issue will then become to determine which fields are important enough to be included in libunicorn

Client deinitialization unrefs without a ref

irc_client_t currently keeps a patricia of peers. On deinitialization, the entire list of peers is first unref'd, and then each channel object is destroyed, leading to more unrefs. Because new peers are not first ref'd before being added to the peer patricia, each peer ends up with a refcount of -1, which leads to undefined behavior.

Channel tracking

An essential feature for any IRC client library.

Keep track of any important data for channels. This includes the topic, the users, and all channel modes, with or without flags. Mode tracking will depend heavily on ISUPPORT parsing.

Speed up channel user fetch.

While adding a user to a channel is very fast (O(1)), finding/removing users is unfairly slow (worst case O(n) where n is the number of users in the channel).

512-byte buffer (like the RFC says)

Although the 512-byte buffer is supposed to include the CRLF as well, it still seems as if the buffer should be able to hold 512 bytes. As of right now, because the buffer is expected to be null-terminated, it can only hold 511 bytes, although very few messages ever get that long.

This is very possibly related to Issue #14 as well.

Properly handle null bytes in irc_message_t

irc_message_t currently works with null-terminated strings. While this is perfectly acceptable for IRC clients (sane servers should NEVER send messages with NULL bytes in them), IRC servers cannot make these same assumptions, as clients connections cannot reasonably be expected to send well-formatted data.

Are the log functions worth having?

The log functions are used in two places in the source code and nowhere else. libmowgli-2 has its own logging functionality. Logging is very much out-of-place for an IRC library.

irc_client_channel_join: check user is not already in channel.

This is a potential memory leak and could lead to strange bugs if the server sends two JOINs for a user but only one PART. (While it is not likely that any stable IRCd would ever do anything along these lines, it is not impossible, and libunicorn should be able to handle such server-side bugs gracefully).

Client state tracking

Track the complete state of a client on the IRC network. This includes the state of every channel the client is in and several facts about the user and the network.

client: properly handle our own nick

The client code does a good job of keeping track of which peers are in sight, but does not do a very good job of distinguishing itself in RPL_NAMREPLY lists from other peers. It is treated as any other nick. While this could be a problem in some situations, it can also be useful.

Right now, the exact way in which this is handled is undefined and a potential source for bugs. (For example, with the current way the code works, no peer nick change event will be generated if the client changes nicks.) The exact behavior should be sorted out into something sensible.

Merge message sender code into message code

This will probably be renamed to irc_message_sender_t or irc_message_source_t. Senders only make sense in the context of messages. The information that the irc_sender_t struct provides is not separate enough from irc_message_t to provide any sort of real reason to keep them separate.

In addition, I could not think of an effective way to keep the sender and message parser/formatters separate. While the same sender may show up over and over again, the message sender is still a property of the message. Thus it makes perfect sense to include sender parser/formatters as part of message.c.

client: edge triggering?

A set of function pointers or a hook table could be very useful for writing IRC client applications. However, the messages themselves already serve as a sort of edge trigger.

If an error occurs in the libunicorn client code but the parent code processes the message anyway, a state desync occurs. For example, if the client code attempts to create new channel objects in response to a JOIN message but fails for some reason, parent code that ignores error conditions will process the JOIN as if everything was successful. Hooks would only be called upon operation success, but a solution to this problem could also be solved through more robust error reporting.

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.