Nat  Kutch

Nat Kutch

1597719420

Connecting to a Jupyter Notebook on a remote Linux machine with an SSH tunnel

My desktop at work is a powerful machine I use for exploratory data analysis and other machine learning work-flows.

In this post I will go over how I connect to my work machine and run Jupyter Notebook workloads when I am working remotely.

SSH into remote machine

Step 1 is to ssh into your remote machine and launch Jupyter Notebook to a local port with the --no-browser option.

user@local_machine$ ssh user@remote_machine 
user@remote_machine$ jupyter notebook --no-browser --port=8889

Setting up an SSH tunnel

Step 2 is to set up an SSH tunnel from your local machine to port 8889 on the remote machine where the Jupyter Notebook is being served.

user@local_machine$ ssh -N -L localhost:8888:localhost:8889 user@remote_mahcine

Here is a break down of the ssh options

  • -N Do not execute a remote command. This is useful for just forwarding ports
  • -L local_socket:remote_socket
  • Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.

#data-science #jupyter-notebook #ssh #machine-learning #remote-working #deep learning

What is GEEK

Buddha Community

Connecting to a Jupyter Notebook on a remote Linux machine with an SSH tunnel
Nat  Kutch

Nat Kutch

1597719420

Connecting to a Jupyter Notebook on a remote Linux machine with an SSH tunnel

My desktop at work is a powerful machine I use for exploratory data analysis and other machine learning work-flows.

In this post I will go over how I connect to my work machine and run Jupyter Notebook workloads when I am working remotely.

SSH into remote machine

Step 1 is to ssh into your remote machine and launch Jupyter Notebook to a local port with the --no-browser option.

user@local_machine$ ssh user@remote_machine 
user@remote_machine$ jupyter notebook --no-browser --port=8889

Setting up an SSH tunnel

Step 2 is to set up an SSH tunnel from your local machine to port 8889 on the remote machine where the Jupyter Notebook is being served.

user@local_machine$ ssh -N -L localhost:8888:localhost:8889 user@remote_mahcine

Here is a break down of the ssh options

  • -N Do not execute a remote command. This is useful for just forwarding ports
  • -L local_socket:remote_socket
  • Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.

#data-science #jupyter-notebook #ssh #machine-learning #remote-working #deep learning

Rodrigo Senra - Jupyter Notebooks

Nosso convidado de hoje é diretor técnico na Work & Co, PhD em Ciências da Computação, já contribuiu com inúmeros projetos open source em Python, ajudou a fundar a Associação Python Brasil e já foi premiado com o Prêmio Dorneles Tremea por contribuições para a comunidade Python Brasil.

#alexandre oliva #anaconda #apache zeppelin #associação python brasil #azure notebooks #beakerx #binder #c++ #closure #colaboratory #donald knuth #fernando pérez #fortran #graphql #guido van rossum #ipython #java #javascript #json #jupyter kenels #jupyter notebooks #jupyterhub #jupyterlab #latex #lisp #literate programming #lua #matlab #perl #cinerdia #prêmio dorneles tremea #python #r #rodrigo senra #scala #spark notebook #tcl #typescript #zope

PostgreSQL Connection Pooling: Part 4 – PgBouncer vs. Pgpool-II

In our previous posts in this series, we spoke at length about using PgBouncer  and Pgpool-II , the connection pool architecture and pros and cons of leveraging one for your PostgreSQL deployment. In our final post, we will put them head-to-head in a detailed feature comparison and compare the results of PgBouncer vs. Pgpool-II performance for your PostgreSQL hosting !

The bottom line – Pgpool-II is a great tool if you need load-balancing and high availability. Connection pooling is almost a bonus you get alongside. PgBouncer does only one thing, but does it really well. If the objective is to limit the number of connections and reduce resource consumption, PgBouncer wins hands down.

It is also perfectly fine to use both PgBouncer and Pgpool-II in a chain – you can have a PgBouncer to provide connection pooling, which talks to a Pgpool-II instance that provides high availability and load balancing. This gives you the best of both worlds!

Using PgBouncer with Pgpool-II - Connection Pooling Diagram

PostgreSQL Connection Pooling: Part 4 – PgBouncer vs. Pgpool-II

CLICK TO TWEET

Performance Testing

While PgBouncer may seem to be the better option in theory, theory can often be misleading. So, we pitted the two connection poolers head-to-head, using the standard pgbench tool, to see which one provides better transactions per second throughput through a benchmark test. For good measure, we ran the same tests without a connection pooler too.

Testing Conditions

All of the PostgreSQL benchmark tests were run under the following conditions:

  1. Initialized pgbench using a scale factor of 100.
  2. Disabled auto-vacuuming on the PostgreSQL instance to prevent interference.
  3. No other workload was working at the time.
  4. Used the default pgbench script to run the tests.
  5. Used default settings for both PgBouncer and Pgpool-II, except max_children*. All PostgreSQL limits were also set to their defaults.
  6. All tests ran as a single thread, on a single-CPU, 2-core machine, for a duration of 5 minutes.
  7. Forced pgbench to create a new connection for each transaction using the -C option. This emulates modern web application workloads and is the whole reason to use a pooler!

We ran each iteration for 5 minutes to ensure any noise averaged out. Here is how the middleware was installed:

  • For PgBouncer, we installed it on the same box as the PostgreSQL server(s). This is the configuration we use in our managed PostgreSQL clusters. Since PgBouncer is a very light-weight process, installing it on the box has no impact on overall performance.
  • For Pgpool-II, we tested both when the Pgpool-II instance was installed on the same machine as PostgreSQL (on box column), and when it was installed on a different machine (off box column). As expected, the performance is much better when Pgpool-II is off the box as it doesn’t have to compete with the PostgreSQL server for resources.

Throughput Benchmark

Here are the transactions per second (TPS) results for each scenario across a range of number of clients:

#database #developer #performance #postgresql #connection control #connection pooler #connection pooler performance #connection queue #high availability #load balancing #number of connections #performance testing #pgbench #pgbouncer #pgbouncer and pgpool-ii #pgbouncer vs pgpool #pgpool-ii #pooling modes #postgresql connection pooling #postgresql limits #resource consumption #throughput benchmark #transactions per second #without pooling

Hire Dedicated Linux Developer

Looking to develop real-time applications?

Hire Dedicated Linux Developer from HourlyDeveloper.io, we have dedicated developers who have vast experience in developing applications for Linux and UNIX operating systems and have in-depth knowledge of their processes, kernel tools, internal architectures, and development packages.

Consult with experts:- https://bit.ly/2ZQ5ySP

#hire linux dedicated developer #linux developer #linux development company #linux development services #linux development #linux developer

Remote Desktop Connection

In this article, we explain how to use Remote Desktop to access your Windows server’s desktop from anywhere in the world. On a normal Windows computer, you have a keyboard, monitor, and mouse that allow you to interact with the machine. For Windows VPS servers hosted on the Internet, things are a bit different because your server could physically be thousands of miles away. To access the desktop of an Internet-hosted server, Microsoft has created a feature known as Remote Desktop.

#tutorials #access #apple #cord #linux #mac #microsoft rdp #mstsc #plesk #rdesktop #rdp #rdp tool #remote access #remote desktop #remote management #windows