Skip to content

Commit

Permalink
[SSI] Export request scaling interface.
Browse files Browse the repository at this point in the history
[SSI] Add generic Control() method for future use.
  • Loading branch information
abh3 authored and osschar committed Oct 10, 2019
1 parent 348ffb1 commit 65901f6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/XrdSsi/XrdSsiClient.cc
Expand Up @@ -47,6 +47,7 @@
#include "XrdSsi/XrdSsiLogger.hh"
#include "XrdSsi/XrdSsiProvider.hh"
#include "XrdSsi/XrdSsiServReal.hh"
#include "XrdSsi/XrdSsiScale.hh"
#include "XrdSsi/XrdSsiTrace.hh"

#include "XrdSys/XrdSysLogger.hh"
Expand Down Expand Up @@ -107,6 +108,8 @@ virtual rStat QueryResource(const char *rName,

virtual void SetCBThreads(int cbNum, int ntNum);

virtual void SetSpread(short ssz);

virtual void SetTimeout(tmoType what, int tmoval);

XrdSsiClientProvider() {}
Expand Down Expand Up @@ -256,6 +259,17 @@ void XrdSsiClientProvider::SetScheduler()
XrdSsi::schedP->Start();
}

/******************************************************************************/
/* X r d S s i C l i e n t P r o v i d e r : : S e t S p r e a d */
/******************************************************************************/

void XrdSsiClientProvider::SetSpread(short ssz)
{
extern XrdSsiScale sidScale;

sidScale.setSpread(ssz);
}

/******************************************************************************/
/* X r d S s i C l i e n t P r o v i d e r : : S e t T i m e o u t */
/******************************************************************************/
Expand Down
30 changes: 30 additions & 0 deletions src/XrdSsi/XrdSsiProvider.hh
Expand Up @@ -89,6 +89,26 @@ class XrdSsiProvider
{
public:

//-----------------------------------------------------------------------------
//! Issue a control operation (future).
//!
//! @param cmd The control command.
//! @param argP The operational argument cast to a void pointer.
//! @param resP A reference to the pointer to hold the operational
//! result object if any.
//!
//! @return Upon success 0 is returned and if a resutt is returned is must
//! cast to te correct pointer type and deleted,when no longer needed.
//! Upon failure, -errno is returned.
//-----------------------------------------------------------------------------

enum CTL_Cmd {CTL_None = 0};

virtual int Control(CTL_Cmd cmd, const void *argP, void *&resP)
{(void)cmd; (void)argP; (void)resP;
return (cmd == CTL_None ? 0 : -ENOTSUP);
}

//-----------------------------------------------------------------------------
//! Obtain a service object (client-side or server-side).
//!
Expand Down Expand Up @@ -222,6 +242,16 @@ virtual void ResourceRemoved(const char *rName) {}

virtual void SetCBThreads(int cbNum, int ntNum=0) {(void)cbNum; (void)ntNum;}

//-----------------------------------------------------------------------------
//! Set the client-size request spread size.
//!
//! @param ssz The maximum number of connections to use to to handle
//! requests. The initial default is 4. This method may be
//! called at any time. An ssz value > 1024 is set to 1024.
//-----------------------------------------------------------------------------

virtual void SetSpread(short ssz) {(void)ssz;}

//-----------------------------------------------------------------------------
//! Set default global timeouts. By default, all timeouts are set to infinity.
//!
Expand Down
10 changes: 6 additions & 4 deletions src/XrdSsi/XrdSsiScale.hh
Expand Up @@ -37,9 +37,9 @@ class XrdSsiScale
{
public:

static const int maxSprd =256;
static const int maxEnt = 32; // Must be power of two
static const int entShft = 8; // Allows a spread of 256
static const int maxSprd = 1024;
static const int maxEnt = 32; // Must be power of two
static const int entShft = 10; // Allows a spread of 1024
static const unsigned int maxPend = 65500;

int getEnt() {entMutex.Lock();
Expand Down Expand Up @@ -88,9 +88,11 @@ bool rsvEnt(int xEnt) {xEnt >>= entShft;
return false;
}

void setSpread(short sval) {if (sval <= 0) maxSpread = 0;
void setSpread(short sval) {entMutex.Lock();
if (sval <= 0) maxSpread = 0;
else if (sval < maxSprd) maxSpread = sval;
else maxSpread = maxSprd;
entMutex.UnLock();
}

XrdSsiScale() : nowEnt(0), maxSpread(4), nowSpread(0)
Expand Down

0 comments on commit 65901f6

Please sign in to comment.