Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
11 KiB

  1. README.txt
  2. Author: Murali R. Krishnan (MuraliK)
  3. Created: Feb 16, 1995
  4. Revisions:
  5. Date By Comments
  6. ----------------- -------- -------------------------------------------
  7. 25-May-95 MuraliK Added info about new files + Bandwidth Throttle
  8. Summary :
  9. This file describes the files in the directory internet\svcs\dll\server
  10. and details related to Internet Common Services DLL
  11. File Description
  12. README.txt This file.
  13. atq.c Asynchronous Thread Queue implementation
  14. buffer.cxx Raw level BUFFER class used by STRING
  15. string.cxx Implementation of STRING class
  16. cpsock.c Connection Protocol Sockets.
  17. datetime.cxx Functions for generating date and time from
  18. given data structures.
  19. debug.cxx Code for Degbugging functions
  20. eventlog.cxx Implementation of EVENT_LOG class
  21. globals.c Globals for tcpsvcs.dll
  22. igateway.cxx Implementation of API for Internet services Gateway calls.
  23. ilogcls.hxx Internet Logging services Class Declarations.
  24. ilogcls.cxx Internet Logging services Class Definitions
  25. ( File and Basic logging)
  26. inetlog.cxx Internet Logging services C APIs.
  27. ilogsql.cxx Internet Logging to SQL using ODBC. Defines INET_SQL_LOG class.
  28. odbcconn.hxx Declares a stand alone ODBC connection class.
  29. odbcconn.cxx Defines member functions for ODBC connection class.
  30. main.cxx DLL initialization function
  31. iisbind.cxx Server binding management.
  32. iisassoc.cxx Server instance association object.
  33. mimemap.cxx Mime map class member functions definition.
  34. mimeutil.cxx Initialization and Cleanup functions for global mimemap object.
  35. registry.txt Defines the layout for registry values common to all services.
  36. rpcsupp.cxx Defines the RPC functions common for Internet Services.
  37. security.cxx Defines the Security related logon functions.
  38. sources
  39. makefile files for NT build.
  40. tcputil.cxx miscellaneous Util functions for Internet Services dll.
  41. tscache.cxx defines the member functions for TS_CACHE.
  42. tsvcinfo.cxx defines member functions for TSVC_INFO object -- which acts
  43. as an interface for each of the service that is allowed.
  44. Implementation Details
  45. <To be filled in when time permits. See individual files for comments section >
  46. Contents:
  47. 1. TSVC_INFO
  48. 2. EVENT_LOG
  49. 3. Internet Gateway processes
  50. 4. STRING and BUFFER classes
  51. 5. ODBC_CONNECTION class
  52. 6. Internet Logging APIs
  53. 7. MIME_MAP class and MimeMapping
  54. 8. Secuirty Functions.
  55. 9. ATQ functionality
  56. 10. ATQ based Bandwidth Throttle
  57. 10. ATQ based Bandwidth Throttle
  58. Author: MuraliK
  59. Date: 25-May-1995
  60. Goal:
  61. Given a specified bandwidth which should be used as threshold,
  62. the ATQ module shall throttle traffic, gracefully. Minimum CPU impact
  63. should be seen; Minor variations above specified threshold is
  64. allowed. Performance in the fast cause (no throttle) should be high
  65. and involve less stuff in the critical path.
  66. Given:
  67. M -- an administrator specified bandwidth which should not be
  68. exceeded in most cases. (assume to be specified through a special API
  69. interface added to ATQ module)
  70. Solution:
  71. Various solutions are possible based on measurements and metrics
  72. chosen. Whenever two possible solutions are possible, we pick the
  73. simplest one to avoid complexity and performance impact. (Remember to
  74. K.I.S.S.)
  75. Sub Problems:
  76. 1) Determination of Exisiting Usage:
  77. At real time determining existing usage exactly is computationally
  78. intensive. We resort to approximate measures whenever possible.
  79. Idea is: Estimated Bandwidth = (TotalBytesSent / PeriodOfObservation).
  80. solution a)
  81. Use a separate thread for sampling and calculating the
  82. bandwidth. Whenever an IO operation completes (we return from
  83. GetQueuedCompletionStatus()), increment the TotalBytesSent for the
  84. period under consideration. The sampling thread wakes up at regular
  85. intervals and caclulates the bandwidth effective at that time. The solution
  86. also uses histogramming to smooth out sudden variations in the bandwidth.
  87. This solution is:
  88. + good, since it limits complexity in calculating bandwidth
  89. - ignores completion of IO simultaneously => sudden spikes are possible.
  90. - ignores the duration took for actual IO to complete (results could be
  91. misleading)
  92. - requires separate sampling thread for bandwidth calculation.
  93. solution b)
  94. This solution uses a running approximation of time taken for
  95. completing an i/o of standard size viz., 1 KB transfer. Initially we start
  96. with an approximation of 0 Bytes sent/second (reasonable, since we just
  97. started). When an IO completes, the time taken for transfer then is
  98. calculated from the count of bytes sent and time required from inception to
  99. end of IO. Now we do a simple average of existing approximation and the
  100. newly caculated time. This gives the next approximation for bandwidth/time
  101. taken. Successively the calculations refine the effective usage measurement
  102. made. (However, we must note, by so simplifying, we offset ourselves from
  103. worrying about the concurrency in IO processing.) In case of concurrent
  104. transfers time taken for data transfer is larger than the actual time only
  105. for the particular transfer. Hence, the solution makes conservative
  106. estimates based on this measured value.
  107. + no separate thread for sampling
  108. + simple interface & function to calculate bandwidth.
  109. - avoids unusaual spikes seen in above solution.
  110. 2) Determination of Action to be performed:
  111. The allowed operations in ATQ module include Read, Write and
  112. TransmitFile. When a new operation is submitted, we need to evaluate if it
  113. is safe(allow), marginally safe(block) or unsafe(reject) to perform the
  114. operation. Evaluation of "safety"ness is tricky and involves knowledge
  115. about the operations, buffers used, CPU overhead for the operation setup,
  116. and estimated and specified bandwidths.
  117. Assume M and B as specified and estimated bandwidths respectively. Let
  118. R,W, and T stand for the operations Read, Write and TransmitFile. In
  119. addition assume that s and b are used as suffixes for small and big
  120. transfers. Definition of small and big are arbitrary and should be fixed
  121. empirically. Please refer the following table for actions to be performed.
  122. Action Table:
  123. ------------------------------------------------------------------------------
  124. \ Action |
  125. Bandwidth\ to be | Allow Block Reject
  126. comparison\ Done |
  127. ------------------------------------------------------------------------------
  128. M > B R,W,T - -
  129. M ~= B W, T R -
  130. (approx. equal) (reduces future traffic)
  131. M < B Ws, Ts Wb, Tb R
  132. (reject on LongQueue)
  133. ------------------------------------------------------------------------------
  134. Rationale:
  135. case M > B: In this case, the services are not yet hitting the limits
  136. specified, so it is acceptable to allow all the operations to occur without
  137. any blockage.
  138. case M ~= B: (i.e. -delta <= |(M - B)| <= +delta
  139. [Note: We use approximation, since exact equal is costly to calculate.]
  140. At this juncture, the N/w usage is at the brink of specified bandwidth. It
  141. is good to take some steps to reduce future traffic. Servers operate on
  142. serve-a-request basis -- they receive requests from clients and act upon
  143. them. It is hence worthwhile to limit the number of requests getting
  144. submitted to the active queue banging on the network. By delaying the Read,
  145. processing of requests are delayed artificially, leading to delayed load on
  146. the network. By the time delayed reads proceed, hopefully the network is
  147. eased up and hence server will stabilise. As far as write and transmit
  148. goes, certain amount of CPU processing is done and it is worthwhile to
  149. perform them, rather than delaying and queueing, wasting CPU usage.
  150. Another possibility is: Do Nothing. In most cases, the load may be coming
  151. down, in which case the bandwidth utilized will naturally get low. To the
  152. contrary allowing reads to proceed may result in resulting Write and
  153. Transmit loads. Due to this potential danger, we dont adopt this solution.
  154. case M < B:
  155. The bandwidth utilization has exceeded the specified limit. This is an
  156. important case that deserves regulation. Heavy gains are achieved by
  157. adopting reduced reads and delaying Wb and Tb. Better yet, reads can be
  158. rejected indicating that the server is busy or network is busy. In most
  159. cases when the server goes for a read operation, it is at the starting
  160. point of processing any future request from client (exception is: FTP
  161. server doing control reads, regularly.) Hence, it is no harm rejecting the
  162. read request entirely. In addition, blocking Wb and Tb delays their impact
  163. on the bandwidth, and brings down the bandwidth utilization faster than
  164. possible only by rejecting Reads. We dont want to reject Wb or Tb, simply
  165. because the amount of CPU work done for the same may be too high. By
  166. blocking them, most of the CPU work does not go waste.
  167. Implementation:
  168. To be continued later.
  169. The action table is simplified as shown below to keep the implementation
  170. simpler.
  171. Action Table:
  172. ------------------------------------------------------------------------------
  173. \ Action |
  174. Bandwidth\ to be | Allow Block Reject
  175. comparison\ Done |
  176. ------------------------------------------------------------------------------
  177. M > B R,W,T - -
  178. M ~= B W, T R -
  179. (approx. equal) (reduces future traffic)
  180. M < B W, T R
  181. ------------------------------------------------------------------------------
  182. Status and Entry point Modifications:
  183. We keep track of three global variables, one each for each of the
  184. operations: Read, Write and XmitFile. The values of these variables
  185. indicate if the operation is allowed, blocked or rejected. The entry points
  186. AtqReadFile(), AtqWriteFile() and AtqXmitFile() are modified to check the
  187. status and do appropriate action. If the operation is allowed, then
  188. operation proceeds normally. If the operation is blocked, then we store
  189. the context in a blocked list. The parameters of the entry points, which
  190. are required for restarting the operation are also stored along with
  191. context. The operation is rejected, if the status indicates rejection. All
  192. these three global variables are read, without any synchronization
  193. primitives around them. This will potentially lead to minor
  194. inconsistencies, which is acceptable. However, performance is improved
  195. since there is no syncronization primitive that needs to be accessed.( This
  196. assertion however is dependent upon SMP implementations and needs to be
  197. verified. It is deferred for current implementation.)