amazon-ssm-agent icon indicating copy to clipboard operation
amazon-ssm-agent copied to clipboard

Session Manager Lags and Slows Down when Copying/Pasting

Open e-moshaya opened this issue 7 years ago • 35 comments

When copying and pasting text into a file for example using session manager, there is extreme lag and very slow. Whereas with ssh, pasting text into files is instantaneous with no noticeable lag.

e-moshaya avatar Dec 25 '18 14:12 e-moshaya

+1 for me also. I also recognized that SSM has problems when e.g. crolling through a file in nano. it doesn't stop when I stop scrolling, but seems to send all keystrokes, no matter what.

kellertobias avatar Jan 25 '19 15:01 kellertobias

It seems that the first 100 characters in clipboard are sent almost instantaneously but, from there, a considerable lag appears in each new character.

dpujadas avatar Feb 12 '19 14:02 dpujadas

This is a thing indeed. Trying to paste in a few lines (100+) of bash script into an instance yesterday, which turned my terminal window into a screensaver (a pretty one, though).

TomGMan avatar Feb 19 '19 16:02 TomGMan

Thank you for the feedback! We will look into this.

AmyZhangAmz avatar Mar 06 '19 01:03 AmyZhangAmz

This issue is fairly major as it makes it hard to use SSM Sessions as a replacement for SSH to a jumpbox.

jonatcorus avatar Mar 07 '19 22:03 jonatcorus

The slowdown doesn't seem to be consistent though. Sure, after the first 100 characters or so you hit the wall, and for quite a while after that it's pretty slow. But then I've seen it speed back up somewhat after a time. If you are unfortunate enough to cat a really long log file you can see this in action. It's still really, really slow but it does seem to "catch it's breath" after a while and smooth out a bit.

Then again, maybe I'm just wishing for it to be fast. :grimacing:

rnhurt avatar Mar 08 '19 06:03 rnhurt

Just to add we are experiencing this too. I am attempting to use only SSM but still have SSH available. It would be ideal to handle this as it prevents moving away from SSH otherwise. Obviously there's some work with the protocol (HTTP is different from SSH after all) but there are other fast signalling systems that could maybe achieve higher throughput, such as websockets.

M1ke avatar Mar 12 '19 10:03 M1ke

@M1ke, it's my understanding that this agent already uses websockets for its communication. If you look in the vendor directory you can see the Gorilla GoLang websocket library and references to the library in the code and tests.

Looking at the Gorilla documentation the buffer size is set to 4096 by default. Perhaps this buffer size is too low for this project and increasing it would eliminate the slowness. :thinking:

rnhurt avatar Mar 12 '19 13:03 rnhurt

+1

jacekbarecki avatar Mar 16 '19 14:03 jacekbarecki

I was working with Session Manager quite heavily this week and found that it felt much more snappy. So I thought I would add a bit of detail to this issue. For a simple test I opened a file and copy and pasted some lines to see if/when it would slow down. It turns out that pasting in 50 simple lines shows the problem pretty well. My test show that it got to about line 35 before it slowed down.

Interestingly, viewing the same file didn't slow down at all. In fact, I can cat pretty large files without too much slowdown. It's still not near as fast as an SSH session but it seems to be manageable.

Agent version: 2.3.372.0 Instance: t3.medium running Amazon Linux 2 Command: vi /tmp/count.txt Content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

rnhurt avatar Mar 16 '19 20:03 rnhurt

We are seeing the same slowness when pasting in ssm sessions. The first 100 or so appears quickly and then it's like watching grandma typing up an early childhood autobiography...

wfeng-fsde avatar Mar 17 '19 15:03 wfeng-fsde

Same for me, copy pasting is a no go into ssm sessions. Also ctrl-c doesn't seem to be recognized most times. Especially frustrating if you are trying to exit a tail of a big file. I found it easier to close the SSM session and to restart it in those scenarios. Doing ls -al on a big directory sometimes lags the session for a whole minute.

donalddewulf avatar Mar 27 '19 12:03 donalddewulf

any sign of improving this? It's super painful.

BenCoughlan15 avatar Mar 28 '19 11:03 BenCoughlan15

+1

tomotway avatar Apr 02 '19 13:04 tomotway

+1

KostiantynKopytov avatar Apr 06 '19 06:04 KostiantynKopytov

+1

hogie48 avatar Apr 08 '19 14:04 hogie48

+1

JSekhon321 avatar Apr 08 '19 15:04 JSekhon321

+1

mdavani avatar Apr 08 '19 16:04 mdavani

+1

rmlsun avatar Apr 09 '19 18:04 rmlsun

Dafuq. Stop the "+1" spam! It is not helpful and only annoying those who have already commented.

Use the thumbs up on the original post.

kellertobias avatar Apr 09 '19 18:04 kellertobias

Dafuq. Stop the "+1" spam! It is not helpful and only annoying those who have already commented.

Use the thumbs up on the original post.

+1

BenCoughlan15 avatar Apr 09 '19 21:04 BenCoughlan15

could someone confirm that the issue comes only from websocket buffer size ?

obazoud avatar May 03 '19 14:05 obazoud

I experienced this bad performance also, but it got much better when I upgraded to the latest session-manager-plugin (https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html).

It may have been commit 346cb4d3a714c788b3c9ce1d6d99a4d3fd5bcf87 that fixed this

alewando avatar May 03 '19 14:05 alewando

Thanks @alewando - work better with latest session-manager-plugin.

obazoud avatar May 03 '19 15:05 obazoud

It looks like latest version solved problems with stdout (eg, cat long files), but copy+paste problem still persists (at least for me). This is my user experience (after pasting 10 lines, ~100 chars, things get slow):

ssm-lag

In addition, ctrl+c doesn't work. So, if you paste a lot of content, you better go and get some coffee ...

dpujadas avatar May 05 '19 21:05 dpujadas

@dpujadas which version of the session-manager-plugin are you using (session-manager-plugin --version)? I just installed version 1.1.17.0 and the problem with slow pasting seems to be gone.

AKoetsier avatar May 13 '19 07:05 AKoetsier

@dpujadas which version of the session-manager-plugin are you using (session-manager-plugin --version)? I just installed version 1.1.17.0 and the problem with slow pasting seems to be gone.

Yes, 1.1.17.0 finally solved the problem for me. Does anybody know how to install a specific version of session-manager-plugin? Following the instructions in the documentation, you always get the latest, but with a docker build (which was my case), docker was using the cache as the URL didn't change ...

dpujadas avatar May 13 '19 14:05 dpujadas

Even with the latest version 1.1.17.0 , if the code is less than 500 lines it is working fine , when the code is more than 650 lines , it just disconnects my connection.

sindhup08 avatar May 28 '19 18:05 sindhup08

The new version is definitely a bit better. Trying to paste really long lines still sees slowdown though. It's faster than it was, but still incredibly slow compared to real SSH. Try pasting a list of 3000 numbers in a single line and you can see what happens.

dorner avatar May 30 '19 17:05 dorner

Also, if you want to stop the paste because of the slowdown with ctrl-c, it just plain doesn't work. :(

dorner avatar May 30 '19 17:05 dorner