Commit 32e9f3f
committed
Implement lazy response decompression with ResponseDecoder interface
This commit addresses vlsi's architectural feedback on PR apache#6389 by
implementing a ResponseDecoder interface pattern to decouple decompression
logic from SampleResult.
Key Changes:
- Created ResponseDecoder interface in core module for pluggable decoders
- Implemented PlainResponseDecoder for uncompressed responses
- Created ResponseDecoderFactory in HTTP module with support for:
* gzip/x-gzip compression (with relax mode support)
* deflate compression (with relax mode support)
* Brotli compression
- Modified SampleResult to:
* Store raw (possibly compressed) response data
* Track content encoding via new responseContentEncoding field
* Lazily decompress on getResponseData() using registered decoders
* Cache decompressed data to avoid repeated decompression
* Use a registry pattern to avoid circular dependencies
- Updated HTTPHC4Impl to:
* Disable automatic decompression (removed RESPONSE_CONTENT_ENCODING interceptor)
* Extract and store Content-Encoding header value
* Store raw compressed response data
- Updated HTTPJavaImpl to:
* Remove inline gzip decompression
* Extract and store Content-Encoding header value
* Store raw compressed response data
Benefits:
- Decoupled architecture as suggested by vlsi
- Memory efficiency: only decompress when data is actually accessed
- CPU efficiency: avoid unnecessary decompression for responses that aren't read
- Maintains backward compatibility
- Supports all existing compression formats (gzip, deflate, brotli)
The implementation uses a registry pattern where the HTTP module registers
its decoders with SampleResult, avoiding circular dependencies between
core and protocol modules.1 parent b4ccab3 commit 32e9f3f
6 files changed
Lines changed: 435 additions & 15 deletions
File tree
- src
- core/src/main/java/org/apache/jmeter/samplers
- protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
Lines changed: 104 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| |||
276 | 286 | | |
277 | 287 | | |
278 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
279 | 303 | | |
280 | 304 | | |
281 | 305 | | |
| |||
322 | 346 | | |
323 | 347 | | |
324 | 348 | | |
| 349 | + | |
| 350 | + | |
325 | 351 | | |
326 | 352 | | |
327 | 353 | | |
| |||
736 | 762 | | |
737 | 763 | | |
738 | 764 | | |
| 765 | + | |
739 | 766 | | |
740 | 767 | | |
741 | 768 | | |
| |||
783 | 810 | | |
784 | 811 | | |
785 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
786 | 818 | | |
787 | 819 | | |
788 | 820 | | |
789 | 821 | | |
790 | 822 | | |
791 | | - | |
| 823 | + | |
792 | 824 | | |
793 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
794 | 854 | | |
795 | 855 | | |
796 | 856 | | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
797 | 899 | | |
798 | 900 | | |
799 | 901 | | |
| |||
1598 | 1700 | | |
1599 | 1701 | | |
1600 | 1702 | | |
| 1703 | + | |
1601 | 1704 | | |
1602 | 1705 | | |
1603 | 1706 | | |
| |||
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
676 | 683 | | |
677 | 684 | | |
| 685 | + | |
678 | 686 | | |
679 | 687 | | |
680 | 688 | | |
| |||
1157 | 1165 | | |
1158 | 1166 | | |
1159 | 1167 | | |
1160 | | - | |
| 1168 | + | |
| 1169 | + | |
1161 | 1170 | | |
1162 | 1171 | | |
1163 | 1172 | | |
| |||
Lines changed: 10 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
242 | | - | |
243 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
| 249 | + | |
246 | 250 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 279 | + | |
| 280 | + | |
284 | 281 | | |
285 | 282 | | |
286 | 283 | | |
| |||
0 commit comments