{5} Assigned, Active Tickets by Owner (Full Description) (4 matches)

List tickets assigned, group by ticket owner. This report demonstrates the use of full-row display.

asaddi

Ticket Summary Component Milestone Type Created
Description
#3 break apart flup.server, flup.middleware, and flup.publisher packages flup.server task 11/29/06

Break flup into 3 separate packages (fate of flup.client still TBD).


#13 PreforkServer recreating processes under high load flup.server enhancement 02/21/07

I'm trying to take advantage of a 4-way machine using the PreforkServer?. While using up to 4 child processes (1 for each cpu), I'd like the server to return to 1 child after load dies down. Specifically I'm using the scgi_fork server. With these settings:

maxSpare=1 maxChildren=4

The number of children jump up to 4 under high load, but the PIDs keep incrementing so I think children are being killed and created while under load. I think that the children should not die until the load drops off.

I get much better performance (100% of 4 cpus) with this setting:

maxSpare=4 maxChildren=4

But then I've got RAM tied up for no reason.

A think that a solution to this is to specify a time to live for excess children. When an excess child has not been used for x seconds, it can be killed. Otherwise it should continue to serve.

Randall - randall at tnr dot cc


#4 change environ key of SessionMiddleware flup.middleware task 11/29/06

Deprecate the 'com.saddi.service.session' environ key. Change it to something like 'flup.service.session'.


#1 lockfile for ShelveSessionStore ? flup.middleware defect 11/26/06

Hello Alan,

I was just wondering why you didn't use a .lock file for the ShelveSessionStore? (as you did with DiskSessionStore?) to resolve the concurrently accesses ?

For example I did a small FileLock? class with a decorator :

class FileLock(object):

        
    def __init__(self, lock_file):
        self._lock_file = lock_file


    def acquireLock(self, timeout=LOCK_TIMEOUT):

        for i in xrange(1, timeout*10):
            try:
                os.open(self._lock_file, os.O_WRONLY | os.O_CREAT | os.O_EXCL,
                        0660)
                return True
            except:
                time.sleep(0.1)
                continue

        try:
            self.isStale() and self.releaseLock()
        except:
            pass

        return False

    
    def isStale(self):
        try:
            return os.stat(self._lock_file).st_mtime < time.time() - 3600
        except OSError:
            return False


    def releaseLock(self):
        os.path.isfile(self._lock_file) and os.unlink(self._lock_file)


    def withLock(self, fct):
        if self.acquireLock():
            try:
                return fct()
            finally:
                self.releaseLock()
        else:
            raise IOError('Cannot acquire lock')


def with_lock(fct):
    return lambda self: self.lock.withLock(lambda: fct(self))


and you can do something like :

class ShelveSession(BaseSession):
    
    def __init__(...):
        super(ShelveSession, self).__init__(...)
      
        lock_file = os.path.join(os.path.dirname(self.session_file), '.lock')
        self.lock = FileLock(lock_file)
        
        # more stuff here

    @with_lock
    def save(self):
        f = shelve.open(self.session_file, 'c')
        f[self.sid] = self.data
        f.close()


    @with_lock
    def load(self):
        f = shelve.open(self.session_file, 'r')
        self.data = f.get(self.sid, None)
        f.close()
    

    @with_lock
    def delete(self):
        f = shelve.open(self.session_file, 'w')

        try:
            del f[self.sid]
        except KeyError:
            pass
        
        f.close()
        self.clear()

Any reason why to not use a lockfile with a shelve ?

Thanks !


Note: See TracReports for help on using and creating reports.