DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Coding
  3. Languages
  4. Pyro4: A New Way of Handling Remote Objects in Python

Pyro4: A New Way of Handling Remote Objects in Python

Chris Smith user avatar by
Chris Smith
·
Feb. 15, 12 · Interview
Like (0)
Save
Tweet
Share
7.33K Views

Join the DZone community and get the full member experience.

Join For Free

Creating applications that allow objects to talk with one another over the network can be a pain, but Pyro 4 not only makes this possible, but does so with minimal programming.  Written in "100% pure Python," Pyro4 is compatible with Python 2.x, Python 3.x, IronPython, Jython, and Pypy.

You can just use normal Python method calls, with almost every possible parameter and return value type, and Pyro takes care of locating the right object on the right computer to execute the method. It is designed to be very easy to use, and to generally stay out of your way. But it also provides a set of powerful features that enables you to build distributed applications rapidly and effortlessly.

-- Pyro

Features

Since its initial release in 2010, Pyro4 has experienced some hefty improvements and additional features.  The change log is available online, but here are some of the key features:

  • support for all Python data types that are pickleable.
  • works between systems on different architectures and operating systems (64-bit, 32-bit, Intel, PowerPC…)
  • name server that keeps track of your object's actual locations so you can move them around transparently.
  • support of automatic reconnection to servers in case of interruptions.
  • one-way invocations for enhanced performance.
  • large amount of unit tests and high test coverage.
  • built upon more than 10 years of existing Pyro history.
  • can use IPv4 and Unix domain sockets (IPv6 is not yet supported but it is being developed)

There is a complete manual that has all the information you will need to get Pyro4 up and running, and a few simple examples are included in the download as well.

Performance

"Pyro4 is really fast at what it does."  And here are some stats to prove it:

benchmark/connections.py:  
2000 connections in 1.139 sec = 1756 conn/sec
2000 new proxy calls in 1.451 sec = 1378 calls/sec
10000 calls in 1.058 sec = 9452 calls/sec

hugetransfer/client.py:  
It took 0.48 seconds to transfer 51269 kilobyte.
That is 106148 k/sec. = 103.7 mb/sec.

batchedcalls/client.py:  

Batched remote calls...
processing the results...
total time taken 0.29 seconds (136500 calls/sec)
batched calls were 14.1 times faster than normal remote calls

More stats are available here.

Security

If you're considering using Pyro4, be sure to heed this Security Warning:

Pyro uses the pickle module to serialize objects and sends them over the network. It is well known that using pickle for this purpose is a security risk (The main problem is that allowing your program to unpickle arbitrary data can cause arbitrary code execution and may wreck or compromise your system). However, Pyro has some security measures in place to deal with this. They are described in the Security chapter. It is strongly advised to read it.


While pickle does pose a threat to security, Pyro provides a few facilities to help, including:

  • Network Interface Binding
  • Running Pyro Servers with Different Credentials/User ID
  • Protocol Encryption
  • Dotted Names (Object Traversal)
  • Environment Variables Overriding Config Items
  • Preventing Arbitrary Connections: HMAC Signature

 

Conclusion:

Pyro4 seems like a great tool for Python developers and is continually being improved upon by a dedicated development team.  Stay tuned for more updates and releases sure to be on the way.

Python (language) Object (computer science) workplace

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Debezium vs DBConvert Streams: Which Offers Superior Performance in Data Streaming?
  • AWS CodeCommit and GitKraken Basics: Essential Skills for Every Developer
  • LazyPredict: A Utilitarian Python Library to Shortlist the Best ML Models for a Given Use Case
  • Metrics Part 2: The DORA Keys

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: