web-dev-qa-db-ja.com

FirefoxがSSHに比べて遅いのはなぜですか?

SSH経由でFirefoxを起動しようとしています

ssh -X user@hostname

その後

firefox -no-remote

しかし、それは非常に遅いです。

どうすれば修正できますか?接続の問題ですか?

40
DevOps85

デフォルトのssh設定では、接続がかなり遅くなります。代わりに以下を試してください:

ssh -YC4c arcfour,blowfish-cbc user@hostname firefox -no-remote

使用されるオプションは次のとおりです。

-Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not
         subjected to the X11 SECURITY extension controls.
 -C      Requests compression of all data (including stdin, stdout,
         stderr, and data for forwarded X11 and TCP connections).  The
         compression algorithm is the same used by gzip(1), and the
         “level” can be controlled by the CompressionLevel option for pro‐
         tocol version 1.  Compression is desirable on modem lines and
         other slow connections, but will only slow down things on fast
         networks.  The default value can be set on a Host-by-Host basis
         in the configuration files; see the Compression option.
 -4      Forces ssh to use IPv4 addresses only.
 -c cipher_spec
         Selects the cipher specification for encrypting the session.

         For protocol version 2, cipher_spec is a comma-separated list of
         ciphers listed in order of preference.  See the Ciphers keyword
         in ssh_config(5) for more information.

ここでの主なポイントは、別の暗号化暗号(この場合はデフォルトよりも速いarcfour)を使用し、転送されるデータを圧縮することです。


注:私はこれについての専門家とはとてもかけ離れています。上記のコマンドは、ブログの投稿で見つけた後で使用したもので、速度が大幅に向上していることに気付きました。以下のさまざまなコメンターは、彼らが何を話しているのかを知っており、これらの暗号化暗号は最高のものではないかもしれないと確信しています。本当に関連があるこの回答の唯一のビットが-Cスイッチは、転送されるデータを圧縮します。

25
terdon

一部のXクライアントをリモートで起動するときの最大の問題の1つは、Xプロトコルであり、SSHオーバーヘッドではありません。 Xプロトコルでは、クライアントとサーバー間で大量のピンポンを行う必要があるため、リモートアプリケーションの場合はパフォーマンスが完全に失われます。

"x2go"(これもデフォルトの設定でsshを上書きします)のようなものを試してみてください。Firefoxが比較すると "ハエ"になっていることがわかります!

いくつかのディストリビューションは、たとえばDebianのテストやStable-Backportsなど、すぐに使えるx2goパッケージを提供しています。しかし、そうでない場合は、 http://wiki.x2go.org/doku.php/download:start を参照してください。これらは、多くのディストリビューション用のビルド済みバイナリパッケージ/リポジトリを提供します。 x2goclient(firefoxを「使用する」コンピューター)とx2goserver(firefoxを実行するコンピューター)をインストールし、フルデスクトップビューなどの単一のXアプリケーションのセッションを構成できます。接続自体SSHで発生します。それは本当に素晴らしいツールです:)

これを使用するには、「x2goclient」を実行します。新しいセッションを作成できるGUIが起動します。サーバーのDNS名、ポート、SSHデータなどを指定し、「セッションタイプ」を選択します。たとえば、完全なリモートKDEまたはGNOMEデスクトップ、または単に「単一のアプリケーション」が必要な場合、「firefox」と入力します。

34
Ariel

sshトンネルを使用して別のマシンを経由してトラフィックをルーティングする方がはるかに良い経験があります。とにかくsshにアクセスできるので、セットアップはとても簡単です。コンピュータのターミナルで、次のように入力します

ssh -vv -ND 8080 user@yourserver

このウィンドウを開いたままにし、トンネルを通過するデータについての詳細なメッセージが表示されることを確認します。

firefoxで、[設定]-> [詳細]-> [ネットワーク]-> [接続:設定]に移動します。

Manual proxy configurationを選択し、SOCKS v5プロキシを追加します。

 SOCKS Host:   localhost    Port 8080

に移動して、新しいIPを確認します。 http://whatismyipaddress.com/

foxy proxyのようなFirefoxアドオンを使用して、プロキシを動的に切り替えることができます。

17
Sebastian

Firefoxの新しいビルドでは複数のインスタンスが許可されるため、FirefoxはSSHよりも非常に遅くなります。帯域幅に問題がある場合は、dilloなどの軽いブラウザを使用すれば、接続速度に気付くことさえありません。

2
Florence Taylor

私はこの投稿が非常に古いことを知っていますが、これにより、about:config

gfx.xrender.enabled = true

注: Firefox 47以降、デフォルトはFalseになりました。

1
Eric McAlvin

特定のボトルネックに役立つものを確認するために実験する必要があります。

私にとっては、圧縮(-C)応答性を、使用できないラグから目立つラグに改善しました。

一部の人が言ったこととは逆に、暗号の選択も影響を与える可能性があります。オンラインでベンチマークを共有している人を見つけることができますが、結果が同じになるとは限りません。どの暗号が最適かはハードウェアに依存します。私にとって、デフォルトの暗号([email protected])はすでに最速のものに縛られていました。

やや現実的な条件下で関連する暗号をベンチマークする簡単なスクリプトを作成しました。コメントの説明:

#!/usr/bin/bash

# Ciphers available to you depends on the intersection of ciphers compiled 
# into your client and the ciphers compiled into your Host.
# Should be manually copied from "Ciphers:" section in your `man ssh_config`
# The script will try all ciphers specified here and will gracefully skip
# ciphers unavailable in the Host.
#ciphers=""
# Example:
ciphers="3des-cbc aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr [email protected] [email protected] [email protected]"

tmp_file=tmp.bin

# Recommend to use an identity file without a passphrase.
# That way you won't have to retype the password at each iteration.
ssh_identity_file=~/.ssh/tmp_id_no_passphrase

ssh_Host="user@Host"

# Size of test file, before encryption.
test_file_size_megabytes=8

# Only create test file if it doesn't yet exists.
# Doesn't check if relevant variables changed, so you'll have to delete
# the $tmp_file to regenerate it.
if test ! -f $tmp_file; then
  echo "Creating random data file" \
    "(size $test_file_size_megabytes MB): $tmp_file"

  # Not the same format as the ssh ciphers.
  # Can be left as is, unless this cipher is not supported by your openssl.
  tmp_file_cipher=aes-128-cbc

  # The purpose of encrypting the $tmp_file is to make it uncompressable.
  # I do not know if that is a concern in this scenario,
  # but better safe than sorry.

  dd if=/dev/zero bs=1M count=$test_file_size_megabytes \
    | openssl enc -$tmp_file_cipher -pass pass:123 \
    > $tmp_file
fi

for cipher in $ciphers ; do
  # Benchmark each $cipher multiple times
  for i in 1 2 3 ; do
    echo
    echo "Cipher: $cipher (try $i)"
    # Time piping the $tmp_file via SSH to $ssh_Host using $cipher.
    # At destination received data is discarded.
    cat $tmp_file \
      | /usr/bin/time -p \
      ssh -i $ssh_identity_file -c "$cipher" $ssh_Host 'cat > /dev/null'
  done
done

# Sample output:

# Creating random data file (size 8 MB): tmp.bin
# *** WARNING : deprecated key derivation used.                                   Using -iter or -pbkdf2 would be better.                                         8+0 records in
# 8+0 records out
# 8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.0567188 s, 148 MB/s

## [redacted]

# Cipher: aes256-cbc (try 3)
# Unable to negotiate with 192.168.99.99 port 22: no matching cipher found. Their offer: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
# real 0.12
# user 0.03
# sys 0.03

# Cipher: aes128-ctr (try 1)
# real 9.68
# user 0.28
# sys 0.51

# Cipher: aes128-ctr (try 2)
# real 10.85
# user 0.26
# sys 0.29

## [redacted]

クライアントとホストが同じマシンであるSSH接続でテストするか、ホストがX11転送を実行するマシンであるより現実的なシナリオでテストするかを選択できます。パフォーマンスはクライアントのパフォーマンスの解読だけでなく、ホストのパフォーマンスにも依存するためです。

リモートマシンを使用したテストでは、ベンチマークの過程でインターネット接続のスループットが変化した場合にノイズが発生するという欠点があります。その場合、各暗号がテストされる回数を増やす必要があるかもしれません。

Sshでのブラウジングを改善するもう1つのことは、Firefoxでパイプラインを有効にすることです。開いた about:config そして変化 network.http.pipelining 真実に。

0
Tanath