Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Первое задание
### Синхронная проверка 100 ссылок (время работы - 185938ms)
![](screenshots/first_profile.png)

### 5 воркеров (время работы - 36440ms)
![](screenshots/5_workers.jpg)

### 10 воркеров (время работы - 24527ms)
![](screenshots/10_workers.jpg)

### 100 воркеров (время работы - 18519ms)
![](screenshots/100_workers.jpg)

#### Используя ThreadPoolExecutor, можно значительно увеличть скорость проверки ссылок.
#### Изменение количества воркеров существенно не влияет на загрузку памяти, процессора. Однако увеличение количества воркеров приводит к уменьшению времени работы программы и увелечению активности отправки и получения в сети.

# Второе задание
#### Генерация одной монеты на одном ядре в среднем занимает 40000 - 60000ms.

### 2 воркера (время генерации пяти монет - 29878ms)
![](screenshots/2_workers2.jpg)

### 4 воркера (время генерации пяти монет - 27118ms)
![](screenshots/4_workers2.jpg)

### 5 воркеров (время генерации пяти монет - 24082ms)
![](screenshots/5_workers2.jpg)

### 10 воркеров (время генерации пяти монет - 26401ms)
![](screenshots/10_workers2.jpg)

### 61 воркер (время генерации пяти монет - 24223ms)
![](screenshots/61_workers2.jpg)

#### Изменение количества воркеров влияет на загрузку памяти и процессора. Максимальное количество воркеров - 61 (ограничение ОС). Увеличение скорости генерации монет будет происходить, пока количество воркеров не превышает число ядер процессора. При 10 и 61 воркерах не происходит увеличение скорости генерации, так как у процессора всего 6 ядер.
23 changes: 23 additions & 0 deletions generating coins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from hashlib import md5
from random import choice
import concurrent.futures


def generate_coin(c):
while True:
s = "".join([choice("0123456789") for i in range(50)])
h = md5(s.encode('utf8')).hexdigest()
if h.endswith("00000"):
c = f"{s} {h}"
break
return c


def main():
with concurrent.futures.ProcessPoolExecutor(max_workers=5) as executor:
for coin in zip(executor.map(generate_coin, [0, 0, 0, 0, 0])):
print(coin)


if __name__ == '__main__':
main()
26 changes: 26 additions & 0 deletions link checking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from urllib.request import Request, urlopen
import concurrent.futures


def get_wiki_page_existence(wiki_page_url):
request = Request(
wiki_page_url,
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 9.0; Win65; x64; rv:97.0) Gecko/20105107 Firefox/92.0'},
)
resp = urlopen(request, timeout=100)
code = resp.code
resp.close()
return code


links = open('res.txt', encoding='utf8').read().split('\n')

with concurrent.futures.ThreadPoolExecutor(max_workers=61) as executor:
futures = []
for url in links:
futures.append(executor.submit(get_wiki_page_existence, url))
for future in concurrent.futures.as_completed(futures):
try:
print(future.result())
except Exception as e:
print(url, e)
100 changes: 100 additions & 0 deletions res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
https://viaf.org/viaf/47558229
https://www.worldcat.org/identities/viaf-47558229
https://id.loc.gov/authorities/names/no2016066396
https://www.idref.fr/028557697
http://warintheaeneid.umwblogs.org/2008/06/13/deception-in-the-aeneid/
https://www.nasa.gov/mission_pages/juno/news/juno20110805.html
http://warburg.sas.ac.uk/vpc/VPC_search/subcats.php?cat_1=5&cat_2=48
https://d-nb.info/gnd/118800574
Binary file added screenshots/100_workers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/10_workers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/10_workers2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/2_workers2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/4_workers2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/5_workers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/5_workers2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/61_workers2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/first_profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.