This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-17
Channels
- # aws-lambda (1)
- # beginners (55)
- # cider (19)
- # clojure (96)
- # clojure-spec (2)
- # clojure-uk (6)
- # clojurescript (22)
- # datomic (6)
- # editors (13)
- # emacs (6)
- # euroclojure (1)
- # hoplon (3)
- # immutant (1)
- # jobs-rus (2)
- # off-topic (2)
- # onyx (4)
- # portkey (3)
- # re-frame (76)
- # reagent (110)
- # shadow-cljs (13)
- # spacemacs (10)
- # specter (9)
- # tools-deps (9)
- # vim (7)
but i figure out that elixir is a lisp {:if, [], [{:!, [], [true]}, [do: {{:., [], [{:aliases__, [], [:IO]}, :puts]}, [], ["this should never be printed"]}]]}
I use a combination of timbre related packages to make aleph talk. Check these out:
[com.fzakaria/slf4j-timbre "0.3.7"]
[com.taoensso/timbre "4.10.0"]
[timbre-ns-pattern-level "0.1.2"]
[ring-logger-timbre "0.7.6"]
[yonatane/timbre-json "0.1.2"]
Plus something similar to this configuration:
(timbre/merge-config!
{:output-fn yonatane.timbre-json/output-fn
:middleware [(timbre-ns-pattern-level/middleware {:all :debug
"org.apache.kafka.*" :info
"org.mongodb.*" :info
"io.netty.*" :info})]})
Hi, why this java interop not compile in clojure?
> (java.util.List/of 1)
CompilerException java.lang.IllegalArgumentException: No matching method: of, compiling:(*cider-repl clj-demo*:149:16)
the java doc is here:@cmal what version of Java are you using? I believe that method was introduced in Java 9
Thanks! I've been using java 10, but maybe cider-jack-in
starts lein
in java 8. Thanks for reminding me of that!
Cider just calls lein. It will do whatever Java gets invoked from there unless the path for you emacs doesn't include your different versions of java
@kulminaator How about doing a performance comparison between timbre and Log4j-2. Log4j2 claims superior performance over log4j. Not sure how it compares with timbre.
@lilactown it's a reader macro; it happens at read time:
=> (read-string "@a")
(clojure.core/deref a)
also @ isn't allowed in symbols according to the edn spec: https://github.com/edn-format/edn#symbols
nor according to https://clojure.org/reference/reader#_symbols
here it is in the source: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L93
Changed to java 10. These still not work:
(List/of 0) ;; => [0]
(List/of 1 2 3) ;; => Method
java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
must be InterfaceMethodref constant
(List/of (Integer. 1)) ;; => Method java.util.List.of(Ljava/lang/Object;)Ljava/util/List; must
be InterfaceMethodref constant
(List/of "s") ;; => Method java.util.List.of(Ljava/lang/Object;)Ljava/util/List; must
be InterfaceMethodref constant
@cmal I think you're hitting this bug: https://dev.clojure.org/jira/browse/CLJ-2298?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab
I've also read CLJ-2284 https://dev.clojure.org/jira/browse/CLJ-2284
Yeah, the one I linked to looks to be a duplicate of that one.
Wait, do you need to sign CA to contribute to the site too?! Oh come on, you gotta be kidding me!
Hi everyone, part of my code requires me to write a function that returns a list of 26 empty lists. Right now I have (conj [] (repeat 26 []))
which I think is returning a list of sequences of list...is there a straightforward way to create a list of empty lists and have the code look that simple and clean?
@marlenefdez I would just (repeat 26 ())
@mfikes perfect, thank you!
Hi folks, question: is clojure a good fit for soft real time systems?
Better yet: is the JVM a good option. I know I could use Erlang, but we have settle on using Clojurescript on frontend.
I know from experience near real time alerting is very good possible on the JVM. But I don't really understand your question. It seems to be about back end, but then you mention Clojurescript.
We are evaluating between Clojure/Elixir for the backend. My question is: is Clojure viable for soft realtime systems? Is using Immutant together with Wildfly a good choice for building clustered apps, or should we go the Elixir/Erlang, or another Clojure stack path?
Not sure what would be the best way to run Clojure. But I don't see any reason it wouldn't be viable.
Elixir/Erlang is meant for fault tolerant systems not real time systems
you can use native compilation of erlang to speed up.. but general advise is not useful. you will have to figure out your load, response time, throughput requirements and see if elixir or clojure would suit the requirement.
There is a book on how to make clojure code run faster and comparable to java code.
Elixir/Erlang is meant for fault tolerant and soft realtime systems @U7ANZ2MTK. 🙂
There are many issues to be considered, how many concurrent users you have
what is the response time required
how cpu intensive your tasks are etc..
Low latency is a must.
And it's all about IO.
In summary only you can answer the question by doing a proof of concept..
Yeah, but I wanted to have a direction for Clojure, because in Erlang the path is more straightforward.
Use clojure for your app with proper tuning as I mentioned earlier, and if there are any cpu intensive parts, write them in java.. Use Java9 AOT compilation to generate native code..
That's one path I can think of
So, I can use Java 9 with lein directly now? I tried a few months ago and I was having issues with Leiningen loading the classpath.
no idea about the issues, but if lein doenot work try boot
Will give a shot, thanks. 🙂 Will try Immutant and Wildfly for clustering as well.
Elixir is 7 years old. Clojure has a history of 10 years and it works on JVM. There are a large number of java libraries and clojure libraries
do you have enough elixir libraries
for your use case?
Elixir is 6 years old and yes, I do.
just looked it up in wikipedia
corrected my statement above
books: Clojure: High Performance JVM Programming by Akhil Wali, Shantanu Kumar, Eduardo Díaz Clojure High Performance Programming - Second Edition: by Shantanu Kumar
Thanks for the references, I'll take a look at them
Soft real-time on the JVM is pretty much the same as any GC’d app. You need to define your goals, keep heap sizes small, and reduce allocations. All of that is very possible on the JVM. You also need to try the two GC implementations available.
And realize that the JVM blows Erlang away in terms of raw performance
Yes, but @U07TDTQNL does clojure offer a way to achieve this without deviating from the "clojure way of doing things"?
Sure, as much as Erlang does. Maybe even more so
The JVM supports zero copy networking for example, where packets are never copied out of the network buffers.
Pedestal has some code that does that, it reads HTTP data directly from packets, allowing for zero copy http services.
Right, I'm not that familiar with Pedestal though, when I started using Clojure at my current job (a few months ago), I went straight into Luminus. I might investigate it. My point here is: Erlang makes almost effortless building low latency software, and since that's my background I'm trying to figure out how to achieve this in Clojure, since it's a requirement for my project. What I need is low latency and it's quite hard to find good stacks that take this in consideration on the JVM (maybe I'm missing something?). I'll give a shot at pedestal though.
But a lot of this depends on what it is that you are building
Low latency isn’t really the same as real-time though
And it depends on what the Latency is measured as. Is it acceptance of a message, durability, or something else
And in my experience this stuff isn’t super easy in Erlang either. Messages get dropped, processed crash, mailboxes backup and system have unexpected bottlenecks.
Well, when you talk about distributed Erlang yeah, that's an issue. When we speak about reliability it also comes with how you deal with the overall architecture of your system, not only with your stack. But when we talk about moving data from this websocket, handle some rules via pattern matching, and broadcasting it to channels, receveing on the other point via pubsub, Erlang is the king. My point is: the behaviour of Erlang's GC is more predictable than JVMs', which means I can care less about erradic jumps on latency.
with erlang unless you know very well how it works, and it takes a while, you're likely to shoot yourself in the foot in one way or another. If you know the model well it can be very powerful tho.
then in terms performance or long as we're talking network io latencies are prolly quite similar, both vms are heavily optimised
ex last time I check http servers written in erlang vs java where in the same ballpark in terms of performance
not sure how much that counts, but in Techempower Web Framework Benchmarks Clojure seems to give much better perf than elixir/erlang. Might just be about configuration.
There was an article where raw nginx and erlang were compared and had similar numbers. Very often benchmarks lie anyway, ex lua frameworks where 99% of the work is actually c, or the same for clojure/java. In this case both vms have very different caracterisics, that should drive the decision, not "x is faster" imho, there's no number crunching involved ;)