Хочешь, чтобы веб-сервисы работали быстрее? Тогда используй Add to dictionary и масштабируемость в "облаке". В докладе кратко представлен проектный опыт сокращения времени тестирования SOAP+REST WS на основе multithreading и возможности масштабируемости в Azure.
5. 5CONFIDENTIAL
STEP BY STEP SOLUTIONS
bake 1000 pancakes for one cook – tooooo long!
bake 1000 pancakes for a group of
cooks – much better!
+ Good approach!
7. 7CONFIDENTIAL
OUR ARCHITECTURE TASK
Need to compare thousands of .xml files in a short time…
Responses are coming from REST and SOAP services
FilestobecomparedinSOAPandRESTservices
8. 8CONFIDENTIAL
ONE THREAD, LAPTOP, 1000 files
Example of a simple method to compare API responses from REST and SOAP services
var comparisionResult = Comparison.Run(validatedUBFContext.FromSOAP,
validatedUBFContext.FromREST);
Laptop processor:
• Processor: Intel® Core™ i5-6300U
• # Cores: 2
• # Threads : 4
Time to process 1000 files (each file is about 50-100Kb size of):
• 31.30min
9. 9CONFIDENTIAL
MUTLITHREADING, SAME LAPTOP, 1000 files
MaxDegreeOfParallelism – number of threads
var opt = new ParallelOptions { MaxDegreeOfParallelism =
int.Parse(ConfigurationManager.AppSettings["DegreeOfParallelization"]) };
Parallel.ForEach(validatedUBFProvider.GetUBFs(ubfStoragePath, opt, validatedUBFContext =>
{try
{var comparisionResult = Comparison.Run(validatedUBFContext.SOAP, validatedUBFContext.REST); } }
Degree
Time,
min
1 31.34
4 10.05
5 8.49
7 8.19
8 7.24
9 6.53
10 6.44
30 6
50 6.22
70 6.56
100 6.35
150 6.14
200 7
0
5
10
15
20
25
30
35
0 20 40 60 80 100 120
Time/Degree
Time to process 1000 files is about 6.30 min instead of 31.30min
10. 10CONFIDENTIAL
MULTITHREADING AS PRE-LOAD TESTING
Even performing this simple testing based on multithreading and sending API requests
(.xml files ~ 60.000 files per day ) to both REST and SOAP services, brought out some
issues:
• DB issues (DB architecture, indexing, procedures, etc.)
• API issues (500 internal server error as internal api issues, scaling, etc.)
• APP CONFIGURATION issues (no specific configuration file, code regression issues, needs
of additional system specific activities like restart IIS which is an issue, etc.)
• Indicating of a maximum request size as a system confines
• Caching issues
• etc.
12. 12CONFIDENTIAL
SCALING IN AZURE : DB (DTU)
Database Throughput Unit (DTU): DTUs provide a way to describe the relative capacity of a
performance level. DTUs are based on a blended measure of CPU, memory, reads, and writes. As
DTUs increase, the power offered by the performance level increases.
14. 14CONFIDENTIAL
MUTLITHREADING, SAME LAPTOP, 1000 files,
scaling in Azure
Because of files to be validatedverifying are processed on VM in Azure (DB + SOAP) on the one
hand and REST service on another one, we can try to play with pricing plans to make better
performance of DB and a instance where service is running.
DTU S2 S0 S0 S0 S1 S3 P1 P2 P2
APP SERVICE S2 S2 S1 S3 S2 S2 S2 S2 P3
Number of threads:10/ min 6.14 6.59 6.49 7.08 6.56 7.01 7.06 6.5 6.57
As it can be seen from the table above, it does not make sense to pay much money for the
more expensive prices plans.
It’s obvious, because laptop cannot send more requests then the processor allows based on
proposed architecture and ‘infrastructure’.
15. 15CONFIDENTIAL
MUTLITHREADING, SERVER, 1000 files, scaling
in Azure
Server processor:
• Processor: Intel(R) Xeon(R) CPU E5-2670 0 2.60GHz
• # Cores: 8
• # Threads : 16
Time to process 1000 files (each file is about 50-100Kb size of) with 100
threads:
• 4.30min
Threads DTU
APP
SERVICE start end dif
100P2 S3 2:49:54 2:54:36 0:04:42
100P1 S3 3:06:25 3:10:49 0:04:24
100S3 S3 3:24:00 3:28:37 0:04:37
100S0 S3 3:58:50 4:04:34 0:05:44
100P2 S1 5:07:30 5:12:27 0:04:57
Scaling in Azure:
S0S3 vs S3S3- the difference is only ~1 min, but in case of 20K files it would be
about 20min