Stephen Blum, CTO and co-founder of PubNub, delves into the exciting transition of PubNub towards Rust integration, highlighting its performance and safety advantages. He shares insights into the challenges of migrating from C, the unique pros and cons of Rust rewrites, and the importance of developer expertise. The conversation also touches on creating engaging resources for developers, such as video tutorials, and humorously discusses the surprising weight of the internet, likening it to that of a strawberry!
PubNub is transitioning its infrastructure from C to Rust to enhance performance and safety in managing real-time communications between devices.
Despite initial challenges with Rust's complexities, the development team recognized long-term efficiency and safety benefits from adopting this programming language.
Deep dives
Introduction to PubNub and Its Functionality
PubNub is a leading PubSub network and developer platform facilitating real-time communication between devices. It handles an enormous volume of messages each month, which enables functionalities such as live location updates for deliveries and seamless multiplayer gaming experiences across various platforms. With its API, developers can engage with devices through different programming languages, making integration straightforward. Examples of its applications include tracking food deliveries in real-time and enhancing gaming experiences on consoles and PCs.
Advantages of Rust Over C
PubNub is increasingly migrating its infrastructure from C to Rust, capitalizing on Rust's performance capabilities and enhanced safety features. Rust offers both memory and concurrency safety, which are critical for managing the billions of connected devices in its network. This transition aims to alleviate the common headaches associated with C, such as memory management issues and segmentation faults. By leveraging Rust, PubNub hopes to enhance system reliability while maintaining high performance, which is essential for its operations.
Challenges and Experiences with Rust
Though the transition to Rust has many benefits, the learning curve associated with its complexities, particularly the borrow checker, presents challenges for the development team. The team initially found it frustrating to navigate Rust's strict compile-time rules, which could lead to significant coding hurdles. However, as familiarity with Rust increased, the developers recognized its advantages in terms of long-term efficiency and safety. This experience highlights Rust's value in maintaining a clean and manageable code base, fostering overall developer satisfaction.
Future Directions for PubNub's Technology Stack
PubNub is poised to continue its evolution by fully adopting Rust across various services, optimizing its existing infrastructure for better scalability and efficiency. The firm intends to rewrite its services entirely in Rust to harness its superior performance compared to C and other languages like Go. As part of this migration, the team emphasizes the importance of building a strong foundation in Rust to ensure that the new code is robust and efficient. This strategic approach not only aims to optimize performance but also to create a more enjoyable development environment for the engineers.
Allen Wyma talks with Stephen Blum about PubNub. PubNub is a real-time communication platform and infrastructure-as-a-service company that is integrating Rust into their stack.
Contributing to Rustacean Station
Rustacean Station is a community project; get in touch with us if you’d like to suggest an idea for an episode or offer your services as a host or audio editor!