NREL/BACnet-state — pull request #1 by lefticus (2014-03-21 21:59:27+00:00)
Title: Performance Improvements for BACnet-state

My testing indicated that the performance problems were coming from inserts into Mongo being lockstep with the querying of the BACnet devices.

I considered adding a queue for insertion into Mongo, but realized I could make significant performance gains by utilizing the `upsert` features of Mongo.

This pull request uses `upsert` whenever possible and shows a 4-6x performance increase over the previous version in my tests.

The pull request also includes enhanced configurability for choosing the timing with preset 'conservative' and 'aggressive' settings, with conservative being the default.

On the Java side, I removed the hard coding for the number of threads in the thread pool and added a configuration option for it:

https://github.com/NREL/BACnet/pull/9

Testing was conducted using the following VirtualBox appliance.

https://drive.google.com/file/d/0B7J5kAfVEWtAR2dIYWJJQ2Q5QUE/edit?usp=sharing

It's easy to run multiple virtual BACnet devices at a time as they only require 128MB of RAM each. Please see the notes below:

> Boots up running bacserv from the bacnet stack open source project. The device ID that is given is the value of the last two octets of the IP address.
>
> If launching multiple instances it's critical to give each a separate MAC address for its primary interface.>
>
> If you want to be able to see the virtual device from another it needs to be bridged with your interface or in a private internal network, NATed virtual machines cannot see each other.
>
> The source code and build tools are provided if you want to tweak the settings. This particular instance has 7026 OIDs to give us time to test the performance.
>
> The virtual machine requires no more than 128MB of ram and the CPU can be throttled to slow it down more / make it act like a real device on a flaky network.