This was the first of three chapters in which I show how to implement a simple distributed monitoring system. This chapter was dedicated to the data structures and the monitoring server component; the subsequent chapters will analyze in detail the structure of the monitoring agents and the statistical analyzer. Important points to keep in mind:

• Always start your projects with a sound design.

• Define all the components that your system is made of and the actions they are going to perform.

• Define the data structures that your components are going to use.

• When designing the database tables, try to get as close as possible to the Third Normal Form, but don't forget that simplicity and practicality also have some influence in the decisions you make.

• Although XML-RPC is a rather old protocol, thanks to its simplicity it's still quite useful for small to medium-scale projects.

• Python has built-in support for XML-RPC: xmlrpclib for the client implementation and SimpleXMLRPCServer for the server implementation.

• CherryPy is useful in automating web framework tasks, and it also has support for the XML-RPC function wrapping.

• Multithreading in Python is not "true" multithreading—even though you run separate threads, only one is active because of the Global Interpreter Lock (GIL) implementation.

• If you need to take full advantage of multiple processors and avoid complex object-locking situations, decouple your components into separate processes that don't have shared data and use the multiprocessing library, which uses processes instead of threads.


Was this article helpful?

0 0

Post a comment