If you are looking out for a small, affordable, low-powered system which comes by default with the power of modern AI for your developers, then NVIDIA Jetson Nano is the answer. NVIDIA Jetson Nano is an embedded system-on-module (SoM) and developer kit from NVIDIA, including an integrated 128-core Maxwell GPU, quad-core ARM A57 64-bit CPU, 4GB LPDDR4 memory, along with support for MIPI CSI-2 and PCIe Gen2 high-speed I/O & that too within $99 price tag. Amazing, isn’t it?
The NVIDIA® Jetson Nano™ Developer Kit is purely an AI computer. It is a small, powerful computer that lets you run multiple neural networks in parallel for applications like image classification, object detection, segmentation, and speech processing. All in an easy-to-use platform that runs in as little as 5 watts. It is perfect for makers, learners, and developers that brings the power of modern artificial intelligence to a low-power, easy-to-use platform.
Why Redis on Jetson Nano?
The major problem with existing IoT devices like Raspberry Pi or Jetson Nano board is that they uses a removable microSD card as its boot device and storage. Hence, the problem of temporarily storing data. Imagine data received by sensors or 4k video images received every seconds on these IoT devices to perform on-device computations. For major of IoT projects, a message queuing system like MQTT is all that is needed to connect sensors, devices and graphic interfaces together. But if you have hard requirements for high throughput or you’re storing special data types like binary data or image files then you should start considering Redis.
Redis is an open source, in-memory Data Structure Store, used as a database, a caching layer or a message broker. Today Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLog, bitmaps, streams, and spatial indexes.
As per this link, Redis is ideal for IoT and Embedded devices for several reasons:
- Redis has a very small memory footprint and CPU requirements. It can run in small devices like the Raspberry Pi Zero without impacting the overall performance, using a small amount of memory, while delivering good performance for many use cases.
- The data structures of Redis are often a good way to model IoT/embedded use cases. For example in order to accumulate time series data, to receive or queue commands to execute or responses to send back to the remote servers and so forth.
- Modeling data inside Redis can be very useful in order to make in-device decisions for appliances that must respond very quickly or when the remote servers are offline.
- Redis can be used as an interprocess communication system between the processes running in the device.
- The append only file storage of Redis is well suited for the SSD cards.
- The Redis 5 stream data structure was specifically designed for time series applications and has a very low memory overhead.
It is important to note that both Redis 4 and Redis 5 versions supports the ARM processor in general. I have been playing around running containerized applications on Jetson Nano and couldn’t wait to try out Redis on top of NVIDIA Jetson Nano.
Preparing Jetson Nano
- Unboxing Jetson Nano Pack
- Preparing your microSD card
To prepare your microSD card, you’ll need a computer with Internet connection and the ability to read and write SD cards, either via a built-in SD card slot or adapter.
- Download the Jetson Nano Developer Kit SD Card Image, and note where it was saved on the computer.
- Write the image to your microSD card( atleast 16GB size) by following the instructions below according to the type of computer you are using: Windows, Mac, or Linux. If you are using Windows laptop, you can use SDFormatter software for formatting your microSD card and Win32DiskImager to flash Jetson Nano Image. In case you are using Mac, you will need Etcher software.
- To prepare your microSD card, you’ll need a computer with Internet connection and the ability to read and write SD cards, either via a built-in SD card slot or adapter
The Jetson Nano SD card image is of 12GB(uncompressed size).
Next, It’s time to remove this tiny SD card from SD card reader and plugin it to Jetson Board to let it boot.
Jetson Nano comes with 18.09 by default
Yes, you read it correct. Jetson Nano is shipped with Docker Engine 18.09 by default. Let us verify OS version running on Jetson Nano first.
Verifying OS running on Jetson Nano
jetson@jetson-desktop:~$ sudo cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
jetson@jetson-desktop:~$
Verifying Docker
jetson@jetson-desktop:~$ sudo docker version
Client:
Version: 18.09.2
API version: 1.39
Go version: go1.10.4
Git commit: 6247962
Built: Tue Feb 26 23:51:35 2019
OS/Arch: linux/arm64
Experimental: false
Server:
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 6247962
Built: Wed Feb 13 00:24:14 2019
OS/Arch: linux/arm64
Experimental: false
jetson@jetson-desktop:~$
Updating OS Repository
sudo apt update
Installing Docker 19.03 Binaries
You will need curl command to update Docker 18.09 to 19.03 flawlessly.
sudo apt install curl
curl -sSL https://get.docker.com/ | sh
jetson@jetson-desktop:~$ sudo docker version
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:32:21 2019
OS/Arch: linux/arm64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:30:53 2019
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
jetson@jetson-desktop:~$
Installing Docker Compose
root@jetson-desktop:/home/jetson# /usr/bin/docker-compose version
docker-compose version 1.17.1, build unknown
docker-py version: 2.5.1
CPython version: 2.7.15+
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
root@jetson-desktop:/home/jetson#
Run Redis Server inside Docker
Jetson Nano is ARMv8 (64bit) and hence we need to verify if ARM64v8 Redis image is available or not.
jetson@master1:~$ docker run --name redis-server -d arm64v8/redis redis-server --appendonly yes
6b80312b1e05499d565c6962b03f852db7064d5be97acb11dae31791b55ef320
jetson@master1:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6b80312b1e05 arm64v8/redis "docker-entrypoint.s…" 6 seconds ago Up 3 seconds 6379/tcp redis-server
jetson@master1:~$
Verify if Redis Server is running or not
jetson@master1:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
340437cc7c7c arm64v8/redis "docker-entrypoint.s…" 35 seconds ago Up 32 seconds 6379/tcp myredis
Checking the Redis Logs
jetson@master1:~$ docker logs -f 4e194
1:C 23 Dec 2019 15:49:21.819 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 23 Dec 2019 15:49:21.819 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 23 Dec 2019 15:49:21.819 # Configuration loaded
1:M 23 Dec 2019 15:49:21.828 * Running mode=standalone, port=6379.
1:M 23 Dec 2019 15:49:21.828 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 23 Dec 2019 15:49:21.828 # Server initialized
1:M 23 Dec 2019 15:49:21.828 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 23 Dec 2019 15:49:21.829 * Ready to accept connections
Running the Redis CLI
jetson@master1:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e1941c5be9b arm64v8/redis "docker-entrypoint.s…" 5 minutes ago Up 4 minutes 192.168.1.7:6379->6379/tcp redis-server
jetson@master1:~$ docker exec -it 4e1941 sh
# redis-cli
127.0.0.1:6379>
Redis PING-PONG Test
# redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
Verifying Redis Command Line Interface
T
The redis-cli is the Redis command line interface, a simple program that allows to send commands to Redis, and read the replies sent by the server, directly from the terminal.
# redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set name collabnix
OK
127.0.0.1:6379> get name
"collabnix"
Testing Redis CLI Counter Test
127.0.0.1:6379> incr counter
(integer) 1
127.0.0.1:6379> incr counter
(integer) 2
127.0.0.1:6379>
Connecting from other Linked container
jetson@master1:~$ docker run -it --rm --link redis-server:redis --name client1 arm64v8/redis sh
# redis-cli -h redis
redis:6379> get name
"collabnix"
redis:6379>
Comments are closed.