This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-30
Channels
- # arachne (1)
- # beginners (1)
- # boot (13)
- # cljs-dev (35)
- # cljsjs (12)
- # cljsrn (11)
- # clojure (77)
- # clojure-austin (14)
- # clojure-brasil (3)
- # clojure-france (1)
- # clojure-poland (4)
- # clojure-russia (23)
- # clojure-spec (39)
- # clojure-uk (14)
- # clojurescript (17)
- # cursive (16)
- # datascript (10)
- # devcards (1)
- # dirac (3)
- # editors (1)
- # emacs (4)
- # jobs (1)
- # jobs-rus (2)
- # luminus (5)
- # off-topic (1)
- # om (85)
- # parinfer (1)
- # perun (12)
- # re-frame (20)
- # reagent (4)
- # spacemacs (1)
- # specter (9)
- # yada (6)
yes, I’d like it to be in ascending order from left to right (that’s depth first I believe)
works well, i think:
(defn index-map [m]
(let [counter (atom 0)] (prewalk #(if (map? %) (assoc % :id (swap! counter inc)) %) m)))
one problem with that function above is that nested maps get transformed too- I wanted to break out of a branch after a node is found. specter’s walker does that so here’s my updated solution, feedback appreciated
(defn transform-with-index [m f]
(let [counter (atom -1)]
(com.rpl.specter.macros/transform [(com.rpl.specter/walker map?)]
#(f (swap! counter inc) %) m)))
@codonnell from #C0FVDQLQ5 with a cleaner solution:
(transform (subselect (walker map?)) (partial map #(assoc %2 :id %1) (range)) [[{} {}] {} {}])
[[{:id 0} {:id 1}] {:id 2} {:id 3}]
It seems like lein replaces :jvm-opts
by default now; how do I just add something (the old behavior)?
I’m trying to add -Djava.awt.headless=true
for my tests so it doesn’t spawn a window when running unit tests.
I suppose you could add the tiered compilation flag to the project.clj
by hand like you used to have to do with older eversions of lein.
I’m just not super happy with specifying things about tiered compilation when all I want to specify is headless awt
I've never done much with alter-var-root but what is the difference between just re-defing a var, except that alter-var-root can alter atomically?
@borkdude: idiomatic clojure has def
only on the top level of a file and uses alter-var-root
in the rare case that the root binding needs to be modified.
Hi guys. Using migratus, rollback doesn't seem to do anything at all. no errors, nothing. how do I debug this thing?
Hey all! I have a problem with performance, which is looking pretty weird for me - but I'm a newbie to JVM.
So the thing is that when I try to test my app's performance with wrk
, it replies ok for some time and then starts replying very slowly - can't reproduce that on my laptop, but it's working that way on production server. I connected to the app with YourKit profiler and I see that for some time there is a lot of writes to socket (~110 MB/s) and 100% CPU load and at some point socket write speed drops to 50 KB/s and CPU load drops to 0. After about 30-40 seconds it resurrects and starts replying fast again.
Thread count during that time is consistently high. I did a thread dump during "dead" phase and it shows a lot of threads waiting for SynchronousQueue$TransferStack
, which seems to me like 'waiting for a connection'. Right now it's with Netty (Aleph), before that it was with Jetty9 (jet), and it was the same, and it's the same with http-kit.
So... Any ideas where to look next to find the source of the problem?
probably worth checking whether you have excessive GC going on - YourKit can tell you that
I even tried to switch to G1GC just in case - and obviously (because I don't have any problems) - it didn't help
in these periods you’re not doing work, so that implies you are waiting
what are you waiting on?
if it’s I/O / sockets then maybe something is misconfigured in your network and/or sockets
look at your thread dump :)
synchronous queues require both producers and consumer threads to be there at the same time - they are 0-length queues
are you waiting for a producer or a consumer?
they look the same regardless :)
353 threads is a lot - is this a big box?
http://spotify.github.io/threaddump-analyzer/ - I use this one and I'm not sure what I'm waiting for 🙂
Try to look at safepoint pauses -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1
I wouldn’t worry about safepoint stuff until much further down the list
"manifold-pool-2-1341" #1449 daemon prio=5 os_prio=0 tid=0x00007f1b4c191800 nid=0xc09 waiting on condition [0x00007f1b01f90000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000003d98e2220> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)
at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:52)
at manifold.executor$thread_factory$reify__29095$f__29096.invoke(executor.clj:36)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:745)
You have a lot of threads doing work. If one thread couldn't reach a safepoint other threads will be waiting for it. And of course, you'll get a thread dump only when it reach the safepoint. AFAIK, yourkit can't report you safepoint pause problems
probably, I don’t know aleph that well
@serce that’s all true, but unlikely to be important in my experience
@alexmiller: I mean I have no ideas where to look at and that's quite easy to do, so I can try it 🙂
I don’t think it’s going to tell you anything useful, but go for it :)
In REPL I can use (Math/abs 1)
, but when I want to load file into repl where it is used I get
CompilerException java.io.FileNotFoundException: Could not locate clojure/math__init.class or clojure/math.clj on classpath.
Does anybody know what might be an issue?you need to understand more about the big picture of your system, how your resources are being used
@madvas: Math is a Java class in the JDK, not a Clojure ns
yeah... but right now what I know is that my system almost stops reading from sockets and writing to sockets, and just keeps threads in the pool waiting for... IDK what
also, I can't reproduce that on my laptop as well, which means something is configured differently?..
@alexmiller: when you say 'how your resources are being used', that's more about the "server" as the system rather than just jvm, right?
yes, primarily that’s what I meant
doesn’t sound like you are having system resources problems with memory or JVM problems with heap/GC
if it is a network issue, that’s a different set of tools, and I haven’t done that kind of work in a long time
@asolovyov: Also, do not rely on YourKit, try to get details staticstic from JVM using keys, the samples would be -XX:+PrintGCApplicationStoppedTime, it won't print timestamps, but show you all the pauses your JVM has
@alexmiller: it seems you were right, I did the simplest possible app with aleph (which does 30k rps on my laptop), and on the server it sharply drops in performance in about 8 seconds %)
Looking for clojure developer with experience in the following libraries to finish building out webdriver system:
-
-
-
Terms: Ongoing hourly contract
Location: Remote OK
Start: Aug 8th