helper file processes

From: Mark Treacy <mark@dont-contact.us>
Date: Tue, 18 Mar 1997 23:07:43 +1100

The rate at which files could safely be removed has long been a performance
bottleneck for squid. Avoidance of this bottleneck shows up as some
unusual hardwired constants and coding. e.g. storeGetSwapSpace(), there's
quite a bit been done there to try and keep the unlink rate down. Likewise
storeDirClean(), and so on.

By moving the unlinks to a different process this gives us a chance to
control the rate in one location. The patch is relative to the last I
sent. The patches are not complete, the code will not compile as
is, and it is certainly not tested.

 - Mark.

Note: line numbers will be out in store.c

*** /tmp/T0a004O. Tue Mar 18 22:41:48 1997
--- tools.c Tue Mar 18 22:38:28 1997
***************
*** 469,485 ****
      return (err);
  }
  
  void
  queue_unlinkrequest(int filenumber, int quiet)
  {
      static int which_child;
! int nth_child;
      LOCAL_ARRAY(char, swapfile, MAXPATHLEN);
  
! file_map_bit_set(filenumber);
! storeSwapFullPath(filenumber, swapfile);
! nth_child = (++which_child%Config.unlinkProcs)
! send unlink swapfile to nth_child process;
  }
  
  /* child process acknowledges the unlink, make the fileno available for reuse */
--- 469,513 ----
      return (err);
  }
  
+
+ struct unlink_request {
+ struct unlink_request *next;
+ int filenumber;
+ };
+
+ static struct unlink_request *ulr_head, **ulr_tail = &ulr_head;
+
  void
  queue_unlinkrequest(int filenumber, int quiet)
  {
+ struct unlink_request *ulr;
+
+ file_map_bit_set(filenumber);
+
+ ulr = xcalloc(sizeof(*ulr));
+ ulr->filenumber = filenumber;
+ *ulr_tail = ulr;
+ ulr_tail = &ulr->next;
+ }
+
+ void
+ send_unlinkrequest()
+ {
+ struct unlink_request *ulr;
      static int which_child;
! int nth_child, i;
      LOCAL_ARRAY(char, swapfile, MAXPATHLEN);
  
! eventAdd("send_unlinkrequest", send_unlinkrequest, NULL, 1);
! for(i = 0; (ulr = ulr_head) && i < Config.maxUnlinksPerRun; i++) {
! storeSwapFullPath(ulr->filenumber, swapfile);
! if(!(ulr_head = ulr->next))
! ulr_tail = &ulr_head;
! xfree(ulr);
! nth_child = (++which_child%Config.unlinkProcs)
! send unlink swapfile to nth_child process;
! }
!
  }
  
  /* child process acknowledges the unlink, make the fileno available for reuse */
Received on Tue Jul 29 2003 - 13:15:40 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:15 MST