HNHacker News
TopNewBestAskShowJobs

paulasmuth

1,388 karma · joined May 22, 2011

submissionscomments
paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
> 1. Does IMPORT TABLE mean that it has to copy data from MySQL Database into its own storage or does it merely mean it will connect to the MySQL db and query it directly?

It will only connect to the MySQL database and won't copy any data into it's own storage. The SQL query will be pushed down into the MySQL database and the chart will be rendered from the result set that is returned by MySQL database (or other external storage system).

> 2. If it is a long query (e.g. a 60 second query), does FnordMetric server cache previous results?

Not yet but this is on the roadmap. (Pull Requests always welcome!)

paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
Yes, you can use FnordMetric to create charts from data in your existing database. Have a look at this documentation page: http://fnordmetric.io/documentation/chartsql/external_data_s...

Here is a simple example for a query that uses an external MySQL database: https://github.com/paulasmuth/fnordmetric/blob/master/fnordm...

Currently we only support CSV and MySQL as external data sources, but a postgres plugin is on it's way.

paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
I think we need to improve the wording in the documentation. The IMPORT statement only creates a "virtual table", it doesn't actually import any data. As much of the query as possible is pushed down into MySQL/the external data source.
paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
However that means you have to write a heap of reptitive glue code (or sed incantations if that's your thing) to mangle your SQL Results into the JSON format your charting tool wants. If you run a lot of ad-hoc queries you have to waste a significant amount of time on this boring legwork that could much better be spent on interesting tasks.

FnordMetric aims to fix that by extending standard SQL; it allows you to express the data query and the chart specification in a coherent fashion (SQL).

paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
That should be fixed if you pull the latest master branch from github. We'll provide binary packages for apt-get and homebrew in the next weeks.
paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
Here is a working example: https://github.com/paulasmuth/fnordmetric/blob/master/fnordm...

And a few bits of documentation here http://fnordmetric.io/documentation/chartsql/external_data_s...

paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
Yes, actually: https://www.gnu.org/philosophy/why-not-lgpl.html
paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
A "deploy to GCE" button is something I am planning to add in the next weeks.
paulasmuth··on ChartSQL: Create Charts and Dashboards from SQL
FnordMetric allows you to query data from a number of sources. CSV Files are one of them, but there are other backends like MySQL and the built-in statsd server. So ideally there is no "middleware step": you generate charts using only sql from your backend data source in a single step.
paulasmuth··on How to zero a buffer
If you set up your tests up correctly they should test the exact binary or shared library that is deployed to production and not some test-specific build.
paulasmuth··on My First Unikernel
Yes, you are right, this is not a binary classification and it really depends on the perspective. What I was trying to say is that - on some levels - the two approaches are almost antithetical.
paulasmuth··on My First Unikernel
> so writing a unikernel like this allows you to select exactly as much as you need for your particular service.

I agree this is a big upside of the authors approach. Less dependencies lead to fewer problems caused by external/upstream changes.

> OCaml isn't all that much slower than C++. To use the Programming Language Shootout as a rough esimation[^1], it can even come close to matching C++ in certain programs, and is rarely more than three times as slow.

I wasn't only referring to raw execution performance but also to GC pauses and GC overhead which I think are the bigger issue. The benchmark you linked tests for compute load so this doesn't really show up. Anecdotal point; in most real world apps I have worked on the GC was a limiting factor.

> Finally: the article didn't say, "the Linux kernel"—it said, "Ubuntu." The kernel itself might be secure and reliable, but a running Linux system is much, much more than just the kernel.

That's the beauty of having a kernel though. If one of those userland processes is broken it won't affect the whole system.

> an arbitrary piece of C code might not segfault given certain input, but a given piece of OCaml code definitely won't.

This assumes that the OCaml compiler/interpreter and the hardware are free of bugs...

paulasmuth··on My First Unikernel
No, this is fundamentally different from docker.

Docker/cgroups/namespaces allow you to isolate multiple applications running in userspace on the same kernel to a very high degree.

This gets rid of isolation and multiprocessing altogether and runs a single application without any kernel at all (i.e. with just a very limited amount of support code linked in).

Put simply; the technology behind docker improves isolation between processes and this does the exact opposite.

paulasmuth··on My First Unikernel
One could argue that threading is not strictly necessary to utilize a multicore machine. A lot of applications (think web apps) can be implemented just fine as a single thread and then scaled up by increasing the number of processes (or the number of virtual machines in this case) rather than the number of threads.

A lot of popular web frameworks follow this paradigm and I would guess that most application code running "in the cloud" is in fact single threaded.

paulasmuth··on My First Unikernel
This sounds like an awesome and fun project to hack on!

However, optimizing around context switches and task preemptions is something you would usually do if your application is actually bound by IO/context switching, is extremely latency sensitive or when you are trying to squeeze the last bits of performance out of a machine. Why did you choose to build such a microoptimized system in a garbage collected language? Doesn't this defeat the purpose of the whole exercise?

I feel the need for more powerful types and built-in/standardized exception handling too, but since performance seems to be one of your major goals, wouldn't something like C++ be a better fit here? You'd get proper error handling and a good type system (with some tradeoffs) without a significant performance penalty.

On a sidenote, I agree that code written in a functional language with a strong type system tends to be easier to get right than bare C, but this doesn't imply that all low-level code is bug ridden and unsafe. In fact the linux kernel is one of the most stable and reliable pieces of software I've had the pleasure to work with so far. Suggesting there is a problem with the linux kernel because it contains "a large amount of C code in security-critical places" seems a bit dishonest.

paulasmuth··on Bitpost – Private decentralized messaging
I see your point, however I have to politely disagree:

The naive solution to the problem you described would be to simply broadcast every email to every possible receiver. And in fact, I believe this is how bitcoin actually works (but I am happy to be corrected).

paulasmuth··on Bitpost – Private decentralized messaging
Can you explain why you think SMTP is not "fully peer-to-peer"?
paulasmuth··on Bitpost – Private decentralized messaging
Mh, I feel stupid now. In which ways other than relying on DNS and IP is "email" centralized?
paulasmuth··on Bitpost – Private decentralized messaging
All your points seem to focus on DNS. Nobody would argue that DNS is a decentralized system. And in fact neither is IP.

As far as I understand nothing in SMTP makes it inherently more centralized than any piece of software that relies on IP (and for that matter, the web itself). Isn't the internet the poster child of a decentralized system? Does bitcoin/bitpost not rely on IP?

paulasmuth··on PredictionIO – A machine learning server
We will open source our CF-based recommendation engine in the next days. We use the code in production (on a site with a few hundred million views a month) with up to 80GB datasets for item<->item CF. The engine generates thousands of recommendations per second per core. HTTP round-trip-time to fetch a recommendation from localhost is well below one millisecond.

I don't have the full engine source code or benchmarks to share right now (hopefully in the next two weeks as it is approved by our legal department), but I can tell you all the hard lifting is done by a library called "libsmatrix", which implements a fast, memory-efficient sparse matrix data structure that is used at the core of the CF algo. libsmatrix is 100% threadsafe and persists to disk (this way you can also work with datasets larger than the available main memory). this library is already open sourced:

    https://github.com/paulasmuth/libsmatrix
Using libsmatrix, you can build the rest of the "engine" in a matter of a hundred lines of C or so...

    #include "smatrix.h"
    smatrix_t* my_smatrix;

    // libsmatrix example: simple CF based recommendation engine
    int main(int argc, char **argv) {
      my_smatrix = smatrix_open(NULL);

      // one preference set = list of items in one session
      // e.g. list of viewed items by the same user
      // e.g. list of bought items in the same checkout
      uint32_t input_ids[5] = {12,52,63,76,43};
      import_preference_set(input_ids, 5);

      // generate recommendations (similar items) for item #76
      void neighbors_for_item(76);

      smatrix_close(my_smatrix);
      return 0;
    }

    // train / add a preference set (list of items in one session)
    void import_preference_set(uint32_t* ids, uint32_t num_ids) {
      uint32_t i, n;

      for (n = 0; n < num_ids; n++) {
        smatrix_incr(my_smatrix, ids[n], 0, 1);

        for (i = 0; i < pset->len; i++) {
          if (i != n) {
            smatrix_incr(my_smatrix, ids[n], ids[i], 1);
          }
        }
      }
    }

    // get recommendations for item with id "item_id"
    void neighbors_for_item(uint32_t item_id)
      uint32_t neighbors, *row, total;

      total = smatrix_get(my_smatrix, item_id, 0);
      neighbors = smatrix_getrow(my_smatrix, item_id, row, 8192);

      for (pos = 0; pos < neighbors; pos++) {
        uint32_t cur_id = row[pos * 2];

        printf("found neighbor for item %u: item %u with distance %f\n",
          item_id, cf_cosine(smatrix, cur_id, row[pos * 2 + 1], total));
      }

      free(row);
    }

    // calculates the cosine vector distance between two items
    double cf_cosine(smatrix_t* smatrix, uint32_t b_id, uint32_t cc_count, uint32_t a_total) {
      uint32_t b_total;
      double num, den;

      b_total = smatrix_get(smatrix, b_id, 0);

      if (b_total == 0)
        b_total = 1;

      num = cc_count;
      den = sqrt((double) a_total) * sqrt((double) b_total);

      if (den == 0.0)
        return 0.0;

      if (num > den)
        return 0.0;

      return (num / den);
    }
paulasmuth··on PredictionIO – A machine learning server
Could you expand on how prediction.io would handle a real world data set containing a few million items/users? How long would it take to generate a single user<->user recommendation at this scale? Does prediction.io require that I keep the whole dataset in main memory and how much memory would I need?

I'm asking, because for us (dawanda.com, one of the biggest ecommerce platforms in germany) most of the development effort on our soon-to-be-opensourced recommendation engine was spent on scaling the CF up from a few thousand test records to a 150 million record production data set.

In the first iteration we also built it completely in scala, but as we were putting more and more data into it, memory usage was exploding. We realized that boxed types had too much overhead and that we had to implement the whole sparse rating/similarity matrix in C [1]. Also we decided to go for a hybrid memory/disk approach which allowed us to process 80GB datasets on a machine with only 64GB main memory.

How did you manage to solve the memory consumption issue for prediction.io in scala? Did you use java raw memory access or did you also swap out data to disk/ssd?

[1] http://github.com/paulasmuth/libsmatrix

paulasmuth··on Show HN: Beautiful real-time dashboards with FnordMetric
Project on Github: https://github.com/paulasmuth/fnordmetric
paulasmuth··on ~2M msgs/second messaging system written in Go
Mh, if I understand correctly the messaging system being tested is https://github.com/derekcollison/nats and it is not written in Go but in Ruby (+EventMachine). Or is there a Go version of NATS?

Also, this is only testing the time it takes the go client to write the messages to the socket, not the time the server takes to process the messages. So the benchmark would be the same with a noop server that reads and discards all incoming traffic. Am I wrong?

paulasmuth··on A bug I won't forget
Oh, Don. No, everything is fine with ruby, I just got bored. And scala... she is so much faster! See you soon in AMS; I'll bring Mikael for fun and profit ;)
paulasmuth··on A bug I won't forget
Heh no, this was the actual bug (that it was reading "random" data from memory on the first iteration). I just hadn't noticed the issue until this "random memory" contained fragments of invalid json.
paulasmuth··on A bug I won't forget
We currently use it extensively for analytics, our product recommendation engine (blog on that soon!) and we are writing a custom scala based http proxy for our new API. In general, we are trying to progessively do more scala and less ruby.

If you (or anybody else) is interrested in hacking with us, please drop me a note (link to your github profile is enough) at paul@dawanda.com :)

paulasmuth··on Redmon - A web interface for managing redis: cli, admin, and live monitoring
Love it! :)
paulasmuth··on Show HN: Redis/ruby-based realtime event-tracking
Oopsiedaisy, the mongoid-reference in the Gemfile is obsolete. I'll remove it right away. Thanks for the tip :)
paulasmuth··on Show HN: Redis/ruby-based realtime event-tracking
Yes, thats exactly what we do with it. We use it to track (among other things) sent/read messages, created ratings, , signups and sales. You can define your own metrics/gauges very easily. Have a look at "doc/ulm_stats.rb" or contact me on skype ("paulasmuth") if you run into any questions or issues :)
paulasmuth··on Show HN: Redis/ruby-based realtime event-tracking
Cool :) We've actually been using it in production for a few months now. You should have a look at "doc/ulm_stats.rb" - that's the configuration from the screenshots and screencasts.

If you have any issues or questions you can always contact me on skype ("paulasmuth")...

← PreviousPage 4 of 5Next →