This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-07
Channels
- # aleph (11)
- # aws (8)
- # bangalore-clj (4)
- # beginners (32)
- # boot (48)
- # cider (2)
- # cljs-dev (57)
- # cljsrn (4)
- # clojars (22)
- # clojure (67)
- # clojure-argentina (2)
- # clojure-austin (9)
- # clojure-berlin (1)
- # clojure-brasil (15)
- # clojure-france (1)
- # clojure-italy (10)
- # clojure-russia (23)
- # clojure-spec (6)
- # clojure-uk (48)
- # clojurescript (143)
- # cursive (15)
- # datomic (30)
- # emacs (18)
- # hoplon (26)
- # instaparse (1)
- # leiningen (1)
- # om (21)
- # om-next (9)
- # parinfer (3)
- # pedestal (3)
- # planck (2)
- # re-frame (53)
- # reagent (4)
- # ring (5)
- # spacemacs (1)
- # specter (10)
- # sql (16)
- # untangled (19)
- # vim (11)
- # yada (2)
@dm3, true. Aleph enables you to make network servers & clients that use Manifold's abstractions. Aleph is splendiferous and Manifold's "Deferred" abstraction really hits the spot. Etc etc.
@petr Yada is built on top of Aleph, and I hear nothing but good things about Aleph. It's built on top of netty, which makes it a solid http server.
overall performance, probably stream handling and the abstractions behind it (depends on what you like, might be subjective)
and aleph is not only a webserver, it's offers more out the box (more general purpose networking lib, including a webserver )
to be taken with a grain of salt, these are fine tuned to perform well in that context too
Well, its as always with benchmarks, looking at the techempower ones, http-kit performs best in most setups
As I said, benchmarks have to be taken with a grain of salt. I had bad experiences with http-kit in production/heavy load personally. Happy with jetty9 based frameworks so far, but aleph is also a good, well tested contender (so is undertow).
@mpenet Just to add my http-kit exp I am running a forked http-kit in prod that instruments it to add metrics logging for request drops (`503` and various status codes) etc
I’ve noticed 503
s at times under load
my exp is from a while ago (prob 2 years ago), but we had deadlocks, 100% cpu spins etc, pretty much a show stopper, we just switched. It was also before the new maintainers stepped in, I don't know how it is now. But I am happy with something less exotic like jetty personally
Aleph was also heavily used by factual if I recall, with some quite impressive numbers behind their usage. So I'd expect it to be solid too
Just wondering here, it's about design, as an example (and a line of code says more than a 1000 pictures, ... 😉 ) : (-> task store dispatch)
dispatch
is based on the properties of task
and dispatches to a task-handler
every task-handler will use some functions somewhere in its workflow, such as check-result
and store-result
(depends on the task and it's result) and act-on-result
(action depends on original task, result of task and task-handler)
every task-handler also can use some functions, such as set-status
and notify-watcher
(can be email, phone, slack, ...)
Does this make sense:
1. core.async
publisher to dispatch to several subscribers (task-handlers)
2. my-ns.core
contains mainly (-> task store dispatch)
(main logic of the namespace)
3. I have a bunch of my-ns.task-handler.handlerX
namespaces, each implementing their own handler logic. I must, however, require these namespaces in my-ns.core
, so I can register (subscribe) the handlers.
4. my-ns.task-handler.util
contains check-result
, store-result
and act-on-result
. I don't put them into core, because if I do, I have to pass them several levels deep, which doesn't make sense to me. All handlers should do this at some point, only, due to the very different logic of each of them, it can be at a very different point.
5. my-ns.task-handler.mixin
contains set-status
and notifiy-watcher
. I can't think of a better name. It are just functions that may be used by the handler, or may not.
Some functions in ....mixin
and ....util
could be multimethods, or I could just use case/cond/match (since they depend on the task and result)
Does this make any sense?
@sveri I'd also note that Pedestal and Aleph aren't really comparable. Pedestal is an application framework, Aleph is a web server.
http-kit has issues with backpressure I believe. This, for example, can cause issues when a client stops receiving from a websocket.
It's probably a good idea to look at benchmarks for the underlying engines if applicable: netty (aleph), jboss (immutant)
Immutant's "underlying engine" is Undertow: http://undertow.io
BTW: in case you haven’t seen it, there’s a new doc site for Pedestal. http://www.pedestal.io
Clojure 1.9.0-alpha14
Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27
user=> (require '[clojure.spec :as s] '[clojure.spec.test :as stest])
nil
user=> (defn f [x] 3)
#'user/f
user=> (s/fdef f :args (s/cat :x nil?) :ret string?)
user/f
user=> (stest/instrument `f)
[user/f]
user=> (f 1) ; (1) are invalid args, which correctly throws exception
clojure.lang.ExceptionInfo: Call to #'user/f did not conform to spec:
In: [0] val: 1 fails at: [:args :x] predicate: nil?
:clojure.spec/args (1)
:clojure.spec/failure :instrument
:clojure.spec.test/caller {:file "user7054451703452456727.clj", :line 1, :var-scope user/eval2314}
user=> (f nil) ; valid args, so the function returns, but it returns an invalid 3 without thrown exception
3
Here, clojure.spec
correctly detects for me when an instrumented function receives invalid :args
input (e.g., (f 1)
), but it does not detect invalid :ret
output (e.g., returning 3
). Am I missing something here?help! https://gist.github.com/vigilancetech-com/97e8726f2be8e18c575334c414d44fd3
@vigilancetech a list of symbols is not a function (it hasn't been compiled yet)
'(fn [] nil)
=> (fn [] nil)
(fn [] nil)
=> #object[user$eval28312$fn__28313 0xa4ee7d8 "[email protected]"]
see? a function is an object that gets printed like that, what you have is a list of symbols that gets printed nicely
so how do I get the compiled version to store in my list and call it later?
`("foo" ~(fn [] nil)) => ("foo" #object[user$eval28348$fn__28349 0x16feb661 "[email protected]"])
ah, right
ok thanks
if you can avoid quoting forms then you'll probably find it easier to understand if you're just getting started with clojure. quoting is like another whole syntax to learn
Well, I'm from elisp so I should have known better 🙂
but elisp has eval so such things would probably work there. My target is clojurescript and I don't want to drag along eval
I can handle the backquote/tilde combo just fine. It was a little different w/elisp
there a good lein template for a CLI app (i.e. a little program you feed a few arguments to and it does a thing) ?
why isn't this valid defrecord
syntax (the destructuring portion)?
(defrecord Blerg [{:keys [a b c]}] ...)
I'm trying to use defrecord
while extending a protocol, and it'd be nice to do something like this.
If I can't destructure here, I have to destructure in each of the protocol's function implementations
or not use a map.
hmm... unless there's a better way, i'll just do one of those
yeah I guess it could be handy, but it's definitely not supported. at a minimum I don't know how you'd deal with the fact that the defrecord positional fields require names, while destructuring lets you omit them
@bfabry thanks for the sanity check, I really thought that feature should be there, and thought I was doing something wrong since it wasn't 🙂 makes sense why not tho.
@ghadi that'd work, thanks for the idea 🙂
Question: How to call a clojure function from Haskell? :thinking_face: Lots of attention on this bountied question, but still no reasonable answer: http://stackoverflow.com/questions/40322749/calling-a-clojure-function-from-haskell
you'll have to create a bit of "glue" yourself, probably by creating a clojure server that haskell can call over a port, or by creating a standalone script that haskell can call from the system...
I love haskell, i love clojure, but i wouldn't personally look forward to merging them like you're attempting
Whoa! I just found this http://dropbox.nakkaya.com/builds/ferret-manual.html
Unclear how old it is, but if good this would solve the problem immediately.
Being able to use clojure in the C/C++ (and hence GHC/Haskell) ecosystem
Interesting I just checked it out although there is no mention (AFAIK) of a FFI
in particular: exporting clojure functions to be consumed by a C/C++ library
@george.w.singer This might also be interesting for you: http://page.mi.fu-berlin.de/scravy/bridging-the-gap-between-haskell-and-java.pdf