PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 131
# -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT """ This module contains FaultDetector class, aimed to track throttling for incoming requests """ import logging import time from datetime import datetime, timedelta from threading import RLock from typing import Tuple, Any from xray.internal.constants import drop_after, check_period, throttling_threshold class FaultDetector: """ Fault Detector class """ def __init__(self): self.logger = logging.getLogger('fault_detector') self.throttling_stat = dict() self.lock = RLock() self.time_marker_file = '/usr/share/alt-php-xray/flush.latest' def __call__(self, t_key: Any, cpu_value: int) -> Tuple[bool, int]: """ Perform fault detection """ with self.lock: try: saved_cpu, _ = self.throttling_stat[t_key] except KeyError: hitting_limits, throttled_time = False, 0 else: hitting_limits, throttled_time = self._was_throttled_since( saved_cpu, cpu_value) self._flush_entry(t_key) return hitting_limits, throttled_time @property def timestamp(self) -> int: """ Current Unix timestamp """ return int(time.time()) @property def _drop_after(self) -> timedelta: """ Drop after value as datetime.timedelta """ return self.timedelta_in_minutes(drop_after) @property def _check_period(self) -> timedelta: """ Check period value as datetime.timedelta """ return self.timedelta_in_minutes(check_period) @property def should_flush(self) -> bool: """ If throttling_stat should be flushed right now regarding check period value """ try: with open(self.time_marker_file) as latest_info: latest_flush_time = int(latest_info.read().strip()) return self.current_delta(latest_flush_time) > self._check_period except (OSError, ValueError): with self.lock: self._update_latest_flush() return False @staticmethod def timedelta_in_minutes(mins: int) -> timedelta: """ Get timedelta object for given number of minutes """ return timedelta(minutes=mins) def current_delta(self, time_stamp: int) -> timedelta: """ Calculate timedelta for given time_stamp from current timestamp """ def _cast(ts: int) -> datetime: """ Make a datetime object from ts (int) """ return datetime.fromtimestamp(ts) return _cast(self.timestamp) - _cast(time_stamp) def save(self, key: Any, cpu: int) -> None: """ Save throttling entry for given key """ stamp = self.timestamp with self.lock: self.logger.debug('Adding new throttling entry %s: (%i, %i)', key, cpu, stamp) self.throttling_stat[key] = (cpu, stamp) self.logger.debug('Throttling entries total %i', len(self.throttling_stat)) def _flush_entry(self, key: Any) -> None: """ Remove throttling entry by given key """ with self.lock: self.logger.debug('Abandon throttling entry %s', key) self.throttling_stat.pop(key, 0) self.logger.debug('Throttling entries total %i', len(self.throttling_stat)) def _was_throttled_since(self, initial_value: int, current_value: int) -> Tuple[bool, int]: """ Check current throttling time of given lve_id vs given initial_value Return: tuple(fact of throttling, throttling time in ms) """ # initial values of throttling time are in nanoseconds! spent_time = (current_value - initial_value) // 1000000 # cast to ms throttling_fact = spent_time > throttling_threshold self.logger.debug('Throttling checked with %i: %s, %i', throttling_threshold, throttling_fact, spent_time) return throttling_fact, spent_time if spent_time > 0 else 0 def flush(self) -> None: """ Clear throttling stat dict """ if self.should_flush: with self.lock: self.logger.debug('Flush started, total entries %i', len(self.throttling_stat)) for key in self._expired_entries(): self._flush_entry(key) self._update_latest_flush() self.logger.debug('Flush finished, total entries %i', len(self.throttling_stat)) def _update_latest_flush(self) -> None: """ Write current timestamp into time marker file """ try: with open(self.time_marker_file, 'w') as latest_info: latest_info.write(str(self.timestamp)) except OSError: self.logger.error('Failed to save timestamp of latest flush') def _expired_entries(self) -> list: """ Collect expired throttling stat entries keys regarding the drop after value """ expired = list() for key, value in self.throttling_stat.items(): _, timestamp = value _delta = self.current_delta(timestamp) if _delta > self._drop_after: self.logger.debug('Expired entry detected %i: %s elapsed', key, _delta) expired.append(key) return expired