[PR #26052] improve: pooling httpx clients for requests to code sandbox and ssrf #31319

Closed
opened 2026-02-21 20:49:14 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/26052

State: closed
Merged: Yes


Summary

Closes #26047

  • refactor SSL verification parsing into core/helper/ssl_verification.py with a cached ssl.SSLContext
  • reuse the helper in SSRF proxy and code executor modules to eliminate redundant context construction
  • add CODE_EXECUTION_SSL_VERIFY config + env sample so sandbox traffic can tune verification independently

Performance Impact

  • for http nodes, the RPS went from 60 to 170
  • for code execution nodes, the RPS went from 110 to 170

workflow setup

Http Node

image

Code Executor Node

image

Before-Afters

Cpu Usage (py-spy) for both types of workflows, sorted by OwnTime(press 3)

Before

image

After

image

Http Node

Before

image

After

image

Code Executor Node

Before

image

After

image
**Original Pull Request:** https://github.com/langgenius/dify/pull/26052 **State:** closed **Merged:** Yes --- # Summary Closes #26047 - refactor SSL verification parsing into `core/helper/ssl_verification.py` with a cached `ssl.SSLContext` - reuse the helper in SSRF proxy and code executor modules to eliminate redundant context construction - add `CODE_EXECUTION_SSL_VERIFY` config + env sample so sandbox traffic can tune verification independently # Performance Impact - for http nodes, the RPS went from 60 to 170 - for code execution nodes, the RPS went from 110 to 170 # workflow setup ## Http Node <img width="769" height="216" alt="image" src="https://github.com/user-attachments/assets/321e8615-fe40-4c99-a7ca-ce5057a5075e" /> ## Code Executor Node <img width="1408" height="354" alt="image" src="https://github.com/user-attachments/assets/55bb0c8e-ed82-4bee-99ed-2df378ff45b2" /> # Before-Afters ## Cpu Usage (py-spy) for both types of workflows, sorted by OwnTime(press 3) ### Before <img width="1461" height="501" alt="image" src="https://github.com/user-attachments/assets/a8e4b5cf-dd2f-41a2-b613-3bcb31ddc2c4" /> ### After <img width="1475" height="610" alt="image" src="https://github.com/user-attachments/assets/f34be1ef-6cdb-4c8b-99e3-d010dbbb4165" /> ## Http Node ### Before <img width="1458" height="823" alt="image" src="https://github.com/user-attachments/assets/156e6c97-53e4-4bd3-9d81-16f53a553b32" /> ### After <img width="1235" height="879" alt="image" src="https://github.com/user-attachments/assets/33e86724-11a6-42c6-b9eb-37010c95f712" /> ## Code Executor Node ### Before <img width="1471" height="765" alt="image" src="https://github.com/user-attachments/assets/fed8c2ae-95b7-48f0-98f1-fe69dbdc345f" /> ### After <img width="1477" height="842" alt="image" src="https://github.com/user-attachments/assets/7b5ed235-b1e5-4c9c-9c44-1108c2b8d4b5" />
yindo added the pull-request label 2026-02-21 20:49:14 -05:00
yindo closed this issue 2026-02-21 20:49:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31319