-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_functions.py
116 lines (102 loc) · 3.85 KB
/
my_functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# %%============== Import libraries =========
import math
import numpy as np
import pandas as pd
import warnings
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.utils import stats
from scipy import stats
# %% ================ Create a class for each technology ==================
# Class for IaaS
# noinspection PyMethodParameters
class iaas:
def nginx(users: int) -> dict:
users = users
vms: int = math.ceil(users / 1024)
ram: int = vms * (8 + 1)
cores: int = vms * (8 + 1)
disk = vms * (255 + 2.5)
technology = 'iaas'
return vms, ram, cores, disk, technology
@property
def framework(users: int) -> dict:
users = users
vms: int = math.ceil(users / 65535)
ram: int = vms * (32 + 1)
cores: int = vms * (8 + 1)
disk = vms * (600 + 2.5)
technology = 'iaas'
return vms, ram, cores, disk, technology
@property
def rel_db(users: int) -> dict:
users = users
vms: int = math.ceil(users / 5000)
ram: int = vms * (24 + 1)
cores: int = vms * (8 + 1)
disk = vms * (100 + 2.5)
technology = 'iaas'
return vms, ram, cores, disk, technology
@property
def memory_db(users: int) -> dict:
users = users
vms: int = math.ceil(users / 10000)
ram: int = vms * (8 + 1)
cores: int = vms * (4 + 1)
disk = vms * (10 + 2.5)
technology = 'iaas'
return vms, ram, cores, disk, technology
def iaas_total(users: int):
users = users
ram = math.ceil(users / 1024) * 9 + math.ceil(users / 65535) * 33 + math.ceil(users / 5000) * 25 \
+ math.ceil(users / 10000) * 9 + 32
cores = math.ceil(users / 1024) * 9 + math.ceil(users / 65535) * 9 + math.ceil(users / 5000) * 5 \
+ math.ceil(users / 10000) * 5 + 16
disk = math.ceil(users / 1024) * 257.5 + math.ceil(users / 65535) * 602.5 \
+ math.ceil(users / 5000) * 102.5 + math.ceil(users / 10000) * 12.5 + 100
return ram, cores, disk
# Class for CaaS
# noinspection PyMethodParameters
class caas:
def nginx(users: int) -> dict:
users = users
instances: int = math.ceil(users / 1024)
ram: int = instances * 8
cores: int = instances * 8
disk = instances * 255
technology = 'caas'
return instances, ram, cores, disk, technology
def framework(users: int) -> dict:
users = users
instances: int = math.ceil(users / 65535)
ram: int = instances * 32
cores: int = instances * 8
disk = instances * 600
technology = 'caas'
return instances, ram, cores, disk, technology
def rel_db(users: int) -> dict:
users = users
instances: int = math.ceil(users / 5000)
ram: int = instances * 24
cores: int = instances * 8
disk = instances * 100
technology = 'caas'
return instances, ram, cores, disk, technology
def memory_db(users: int) -> dict:
users = users
instances: int = math.ceil(users / 10000)
ram: int = instances * 8 + 1
cores: int = instances * 4
disk = instances * 10
technology = 'caas'
return instances, ram, cores, disk, technology
def caas_total(users: int):
users = users
ram = math.ceil(users / 1024) * 8 + math.ceil(users / 65535) * 32 + math.ceil(users / 5000) * 24 \
+ math.ceil(users / 10000) * 8 + 32.5
cores = math.ceil(users / 1024) * 8 + math.ceil(users / 65535) * 8 + math.ceil(users / 5000) * 8 \
+ math.ceil(users / 10000) * 8 + 1.5
disk = math.ceil(users / 1024) * 255 + math.ceil(users / 65535) * 600 \
+ math.ceil(users / 5000) * 100 + math.ceil(users / 10000) * 10
return ram, cores, disk