Overview
The article discusses the author's experiments in building ClickHouse, a fast columnar SQL DBMS, on an Android phone. It details the challenges faced during the setup process, the use of the Android toolchain, and the performance benchmarks achieved on a smartphone compared to traditional laptops.
What You'll Learn
1
How to build and run ClickHouse on an Android device
2
Why Android's linker and binary requirements differ from standard Linux
3
How to troubleshoot memory issues when running ClickHouse on limited hardware
Prerequisites & Requirements
- Basic understanding of SQL databases and Android development(optional)
- Familiarity with CMake and Android NDK
Key Questions Answered
What are the steps to run ClickHouse on an Android phone?
To run ClickHouse on an Android phone, you need to set up the Android toolchain, modify compilation flags for compatibility, and handle specific linker and memory layout issues. The process involves using Termux to run a UNIX-like environment and ensuring the binary is relocatable.
How does ClickHouse perform on an Android device compared to a laptop?
The performance benchmark shows that the Google Pixel 3a is about five times slower than a Dell XPS 15 laptop on average. However, for queries that fit into memory, the performance is quite acceptable, demonstrating that high-end smartphones can handle substantial workloads.
What common errors occur when trying to run ClickHouse on Android?
Common errors include linker issues due to path differences, incorrect binary types, and memory allocation problems leading to segmentation faults. These issues arise from the differences in how Android handles binaries compared to traditional Linux systems.
Key Statistics & Figures
Performance comparison
5 times slower
The Google Pixel 3a is approximately five times slower than the Dell XPS 15 laptop on average for ClickHouse queries.
Memory usage
1.1 GB
The size of the ClickHouse binary on the phone before stripping debug symbols.
Reduced binary size
400 MB
The size of the ClickHouse binary after removing debug symbols.
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Database
Clickhouse
Used as a fast columnar SQL DBMS for real-time reporting on Android.
Tools
Termux
Provides a UNIX-like environment on Android for running shell commands.
Build System
Cmake
Used for cross-compiling ClickHouse for the Android platform.
Tools
Android Ndk
Used for building native applications for Android.
Key Actionable Insights
1When building applications for Android, always consider the specific requirements of the Android toolchain and its differences from standard Linux environments.This is crucial for ensuring compatibility and performance when running complex applications like ClickHouse on mobile devices.
2Benchmarking your application on actual hardware can provide valuable insights into performance limitations and capabilities.Using ClickHouse as a benchmark on smartphones can help determine the suitability of devices for data-intensive applications.
3Managing memory effectively is essential when running resource-intensive applications on devices with limited RAM.Understanding how to optimize memory usage can prevent crashes and improve application stability on mobile platforms.
Common Pitfalls
1
Assuming that binaries built for standard Linux will work seamlessly on Android.
This often leads to linker errors and compatibility issues due to the differences in how Android handles executable files.
2
Neglecting to optimize memory usage when deploying applications on devices with limited resources.
This can result in applications being killed by the operating system due to out-of-memory errors, especially with resource-intensive applications like ClickHouse.
Related Concepts
Cross-compilation
Memory Management In Mobile Applications
Performance Benchmarking