[muscle] Re: Question about server behaviour
- From: Jeremy Friesner <jaf@xxxxxxxxxxxxxx>
- To: muscle@xxxxxxxxxxxxx
- Date: Tue, 1 Jan 2008 12:24:34 -0800
On Jan 1, 2008, at 11:19 AM, James Mansion wrote:
Yup, that worked a treat - thanks. Slugged the throughput somewhat,
but the DOS effect has gone.
Cool... you might play around with the timeout value a bit to see
where the best tradeoff between throughput and responsiveness is. Or
another approach (which might be a bit more CPU efficient) would be to
install an IOPolicy that limits the number of bytes received per call
to DoInput()... that way the code wouldn't be calling GetRunTime64()
after every message received. To so it that way, you would get rid of
the SetMaximumSuggestedTimeSlice() call and instead modify the setup
code in muscled.cpp (or your equivalent thereof) to look something
like this:
// A trivial input policy -- all it does is ensure that calls to
DoInput() don't try to parse more than 16KBytes per call
class MyInputPolicy : public AbstractSessionIOPolicy
{
public:
MyInputPolicy() {}
virtual void PolicyHolderAdded(const PolicyHolder &) {}
virtual void PolicyHolderRemoved(const PolicyHolder &) {}
virtual void BeginIO(uint64) {}
virtual bool OkayToTransfer(const PolicyHolder &) {return true;}
virtual uint32 GetMaxTransferChunkSize(const PolicyHolder &)
{return 16*1024;} // or however many bytes you like
virtual void BytesTransferred(const PolicyHolder &, uint32) {}
virtual void EndIO(uint64) {}
};
// A session factory that installs a MyInputFactory on each session it
creates.
class MyReflectSessionFactory : public ReflectSessionFactory
{
public:
MyReflectSessionFactory() {}
AbstractReflectSessionRef CreateSession(const String &, const
IPAddressAndPort &)
{
DumbReflectSession * drs = newnothrow DumbReflectSession;
if (drs) drs->SetInputPolicy(PolicyRef(newnothrow
MyInputPolicy));
return AbstractReflectSessionRef(drs);
}
};
[... and in main(), you'd replace the StorageReflectFactory and/or
FilterSessionFactory stuff with... ]
MyReflectSessionFactory myFactory;
server.PutAcceptFactory(2960, ReflectSessionFactoryRef(&myFactory,
false));
(Quiet round here last year! Are there many users?)
Not too many.... or if there are, they keep quiet ;^)
Jeremy
- References:
- [muscle] Question about server behaviour
- From: James Mansion
- [muscle] Re: Question about server behaviour
- From: Jeremy Friesner
- [muscle] Re: Question about server behaviour
- From: James Mansion
Other related posts:
- » [muscle] Question about server behaviour
- » [muscle] Re: Question about server behaviour
- » [muscle] Re: Question about server behaviour
- » [muscle] Re: Question about server behaviour
(Quiet round here last year! Are there many users?)
- [muscle] Question about server behaviour
- From: James Mansion
- [muscle] Re: Question about server behaviour
- From: Jeremy Friesner
- [muscle] Re: Question about server behaviour
- From: James Mansion