-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
high nrepl/cider latency #1320
Comments
|
FTR, I don't experience any hangs. But I do experience a lag after the repl displays the evaluation result but before it prints the new prompt. There's no hang, but it takes about 0.3 sec to display the new prompt. I've tracked this issue down to the track-state middleware, and it might be related to your problem. |
This fixes a lag of about 300ms between receiving eval result and receiving the "done" status, which translated as a lag on printing the repl prompt. This might be related to clojure-emacs/cider#1320.
This fixes a lag of about 300ms between receiving eval result and receiving the "done" status, which translated as a lag on printing the repl prompt. This might be related to clojure-emacs/cider#1320.
I see a similar delay, and it's several seconds long (it's a quite large project). I cannot find any backtrace with
|
Once clojure-emacs/cider-nrepl#252 has been merged, I'm thinking we'll have to add an option to disable the state tracker for those with really large projects. Does anyone know of a way to determine which namespaces come from deps and which are part of the project? That would help a lot. |
You can use |
@claj Could you check something for me? What do you get (how many ms) if you run the following?
|
@Malabarba, thanks for looking into this!
Actually, I think |
Jeez. I just ran the same query on
|
@expez that's pretty fast. It takes about 100ms for me on the cider-nrepl repo, and that only includes the cider namespaces directly, no dependencies or anything. |
You guys have SSDs right? Anyway, @Malabarba the fact that this is too slow shouldn't really be a problem. We don't have to do this synchronously or all the time. We can figure out which namespaces are dependencies once, in the background on startup, and keep the answer around for the duration of the session. |
Well that explains it.
I thought about that, but I'm not sure it would work. Isn't it possible that some dependencies are not loaded initially, but become loaded during the session (after the user requires them)? Then we would end up thinking these deps are new user namespaces. |
Absolutely. Thankfully |
@Malabarba your description of the pause before displaying the next repl prompt fits my second case. There is also the long pause during connection setup. When I pressed When I pressed Debugger entered--Lisp error: (quit)
accept-process-output(nil 0.01)
nrepl-send-sync-request(("op" "eval" "session" "52b5bad3-f3bd-446e-a9f2-4ed5dc5acb32" "code" "(str *ns*)" "id" "4") #<buffer *cider-repl localhost:6005*>)
nrepl-sync-request:eval("(str *ns*)" #<buffer *cider-repl localhost:6005*> "52b5bad3-f3bd-446e-a9f2-4ed5dc5acb32" nil)
cider-nrepl-sync-request:eval("(str *ns*)")
cider-repl-set-initial-ns(#<buffer *cider-repl localhost:6005*>)
cider-repl-init(#<buffer *cider-repl localhost:6005*>)
cider--connected-handler()
run-hooks(nrepl-connected-hook)
nrepl-start-client-process("localhost" "6005")
cider-connect("localhost" "6005")
#<subr call-interactively>(cider-connect record nil)
ad-Advice-call-interactively(#<subr call-interactively> cider-connect record nil)
apply(ad-Advice-call-interactively #<subr call-interactively> (cider-connect record nil))
call-interactively(cider-connect record nil)
command-execute(cider-connect record)
execute-extended-command(nil "cider-connect")
smex-read-and-run(("toggle-debug-on-quit" "cider-jack-in" "disable-theme" "linum-mode" "cd" "5x5" "arp" "cider-quit" "git-gutter:toggle" "set-mode-line-box" "ag" "ack" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "deft" "diff" "dirs" "ffap" "ffip" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pong" "smex" "talk" "term" "undo" "yank" "zone" ...))
smex()
#<subr call-interactively>(smex nil nil)
ad-Advice-call-interactively(#<subr call-interactively> smex nil nil)
apply(ad-Advice-call-interactively #<subr call-interactively> (smex nil nil))
call-interactively(smex nil nil)
command-execute(smex) |
- Don't build the namespace map ourselves, just use ns-map. - Don't track changes in namespaces from jar files. - Since the client still needs to know what's in these jar namespaces, we send their info on the first message, but we ONLY do that for namespaces that are :require'd by a source namespace. This guarantees we only send namespaces that are potentially useful, and reduces the amount of garbage we send on the first message This fixes a lag of about 300ms between receiving eval result and receiving the "done" status, which translated as a lag on printing the repl prompt. This might solve clojure-emacs/cider#1320, depending on the size of project namespaces, but we should probably still offer a way to disable it.
PR clojure-emacs/cider-nrepl#253 should improve this situation considerably. Besides some low-level performance improvements, it implements @expez's idea of skipping namespaces from jar files. If the project
Thanks @j0ni, this seems to confirm what I thought. |
@j0ni Let me know if the lag is any better after you upgrade to the latest snapshot. |
@Malabarba thanks - any idea how long it will be before the snapshot makes it to clojars? |
It has been there for a few hours now. On Tuesday, September 15, 2015, J Irving notifications@github.com wrote:
|
@j0ni you can pull in a new snapshot forcefully by doing |
OK, finally got a chance to test this. The first pause, when setting up the nrepl connection, has been reduced to 8 or 9 seconds from 15+. There's no perceptible (to me) change in the lag using the repl. |
This should fix all lags associated with the new namespace tracking, both the long delay at first connection and the ~1sec lag in the REPL.
Good, that's progress. :) |
[Fix clojure-emacs/cider#1320] Do state tracking in a future
[Fix #1320] Update cider-repl--state-handler with the new syntax
I follow the cider
HEAD
via melpa, and update daily.Sometime in the last week I have noticed a sudden increase in latency, both during the connection setup when I make my connection to a running nrepl server, and when using the repl interactively in emacs.
It now takes more than 15 seconds now between
nREPL: Direct connection established
andConnected.
, during which emacs hangs. After that, every interaction with cider's repl takes a second or two to return.Now I have switched back to 0.9.1 (need to work) and everything is snappy and quick again.
What additional information would help debug this?
The text was updated successfully, but these errors were encountered: