blacklist backup process tree #59

Closed
lastguru1 opened this Issue Mar 16, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

lastguru1 commented Mar 16, 2012

Hi,

I am planning to use flashcache for a filesystem, on which there is a regular cron job for making backups. For simplicity sake, let's say I am using writearound tactic and the backup job just reads... dealing with writes is another topic and I am not interested in it right now (let's say, writes are remote, for example). Do I presume correctly, that there would be no need for setting DIRECT_IO in this case and blacklist PID would work as intended?

Now the real kicker is that I am using cPanel backup procedure, that executes other processes to do the actual work (including running gtar command). How do I effectively blacklist a process tree to stop all these processes from rewriting the cache, effectively nullifying the flashcache effect (the backup procedure reads a larger amount of data than could fit onto SSD)?

I understand that theoretically I could make a wrapper for gtar and other disk-intensive processes, that would register the particular process in blacklist, and then exec the real binary (and also make a cron job to cleanup)... but that would be a horribly dirty hack. I do hope that there is a better way...

Thanks for your time,
Dmitry

Contributor

mohans commented Mar 18, 2012

If the backup job does does reads, you should try a wrapper script to the backup
jobs that

  1. kick off the jobs.
  2. look up the pids of the backup jobs and add these to the blacklist.
  3. when the backup jobs finish, remove these pids from the blacklist (or simply
    remove all pids from the blacklist).

From: lastguru1
reply@reply.github.com

To: Mohan Srinivasan mohan_srinivasan@yahoo.com
Sent: Fri, March 16, 2012 3:09:13 AM
Subject: [flashcache] blacklist backup process tree (#59)

Hi,

I am planning to use flashcache for a filesystem, on which there is a regular
cron job for making backups. For simplicity sake, let's say I am using
writearound tactic and the backup job just reads... dealing with writes is
another topic and I am not interested in it right now (let's say, writes are
remote, for example). Do I presume correctly, that there would be no need for
setting DIRECT_IO in this case and blacklist PID would work as intended?

Now the real kicker is that I am using cPanel backup procedure, that executes
other processes to do the actual work (including running gtar command). How do I
effectively blacklist a process tree to stop all these processes from rewriting
the cache, effectively nullifying the flashcache effect (the backup procedure
reads a larger amount of data than could fit onto SSD)?

I understand that theoretically I could make a wrapper for gtar and other
disk-intensive processes, that would register the particular process in
blacklist, and then exec the real binary (and also make a cron job to
cleanup)... but that would be a horribly dirty hack. I do hope that there is a
better way...

Thanks for your time,
Dmitry


Reply to this email directly or view it on GitHub:
facebook#59

Contributor

lastguru1 commented Mar 19, 2012

the main problem with this approach is that the backup script is within an openvz container, so I need to make some kind of pipe or other similar way to deliver backup process pids to the host... this is very very dirty :( would it be a significant performance penalty for flashcache to check parent pid?

Contributor

mohans commented Mar 19, 2012

No, it would not be a significant penalty, you can probably blacklist the parent
pid and add a check for flashcache_cacheable().


From: lastguru1
reply@reply.github.com

To: Mohan Srinivasan mohan_srinivasan@yahoo.com
Sent: Mon, March 19, 2012 2:48:00 PM
Subject: Re: [flashcache] blacklist backup process tree (#59)

the main problem with this approach is that the backup script is within an
openvz container, so I need to make some kind of pipe or other similar way to
deliver backup process pids to the host... this is very very dirty :( would it
be a significant performance penalty for flashcache to check parent pid?


Reply to this email directly or view it on GitHub:
facebook#59 (comment)

Contributor

lastguru1 commented Mar 20, 2012

so if i want to have a process group id checked there (which is probably safer that just parent id in case backup job spawns plenty of processes) i would add something like this:

dontcache = flashcache_find_pid_locked(dmc, get_task_pid(current, PIDTYPE_PGID), FLASHCACHE_BLACKLIST);

somewhere in flashcache_uncacheable() ?

what are the chances that you would include this in the official version if i will give you a working patch?

Contributor

mohans commented Mar 20, 2012

Yes. This change should do it.

I am not sure this is going to be useful in general though. We already use the
pid and the tgid (for pthreads).


From: lastguru1
reply@reply.github.com

To: Mohan Srinivasan mohan_srinivasan@yahoo.com
Sent: Mon, March 19, 2012 8:43:59 PM
Subject: Re: [flashcache] blacklist backup process tree (#59)

so if i want to have a process group id checked there (which is probably safer
that just parent id in case backup job spawns plenty of processes) i would add
something like this:

dontcache = flashcache_find_pid_locked(dmc, get_task_pid(current, PIDTYPE_PGID),
FLASHCACHE_BLACKLIST);

somewhere in flashcache_uncacheable() ?

what are the chances that you would include this in the official version if i
will give you a working patch?


Reply to this email directly or view it on GitHub:
facebook#59 (comment)

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment