We are currently looking into the performance of the IceStorm service to see if we can use if more wisely. We plan to run some profiling today, and I may be back with some more questions when we have done that, but for now I just want to ask about some things I stumbled across when looking at the source code.
In TopicManagerI I found this:
The most interesting bit being the call of reap() which does the following:Code:TopicPrx TopicManagerI::retrieve(const string& name, const Ice::Current&) const { IceUtil::Mutex::Lock sync(*this); TopicManagerI* This = const_cast<TopicManagerI*>(this); This->reap(); if(_topicIMap.find(name) != _topicIMap.end()) { Ice::Identity id; id.name = name; return TopicPrx::uncheckedCast(_topicAdapter->createProxy(id)); } NoSuchTopic ex; ex.name = name; throw ex; }
It seems to me this makes the cost of a retrieve call liniar in the number of topics, all because we want to clean out destroyed topics. I was wondering why it has to be done this why - Why the removal isn't simply done when the topic is destroyed.Code:void TopicManagerI::reap() { // // Always called with mutex locked. // // IceUtil::Mutex::Lock sync(*this); // TopicIMap::iterator i = _topicIMap.begin(); while(i != _topicIMap.end()) { if(i->second->destroyed()) { if(_traceLevels->topicMgr > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat); out << "Reaping " << i->first; } _topics.erase(i->first); try { Ice::Identity id; id.name = i->first; _topicAdapter->remove(id); } catch(const Ice::ObjectAdapterDeactivatedException&) { // Ignore } _topicIMap.erase(i++); } else { ++i; } } }
Likewise I found this in TopicI
And I was wondering what the priority of this optimization is.Code:// // TODO: Optimize // // It's not strictly necessary to clear the error'd subscribers on // every publish iteration (if the subscriber validates the state // before attempting publishing the event). This means more mutex // locks (due to the state check in the subscriber) - but with the // advantage that publishes can occur in parallel and less // subscriber list iterations. // void IceStorm::TopicSubscribers::publish(const EventPtr& event)
Finally I was wondering if it would be possible to get an estimate of the cost of the various operations in the IceStorm system Something like a O(n) rough estimate of the performance in terms of the number of topics, the number of subscribers etc. I know this last bit is a bit vague, and it isn't a big priority, it would just be nice to have some idea about best practices like when to split the load over several IceStorm services, how important it is to unsubscribe and clean-up unused topics etc.

Reply With Quote
. And writing realistic performance tests to figure the capacity is often quite difficult.