Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Enhance Locust load testing and optimize database settings #6265

Merged
merged 9 commits into from
Feb 17, 2025

Conversation

ogabrielluiz
Copy link
Contributor

Improve Locust load testing capabilities with dynamic configurations, error handling, and realistic simulations. Optimize database connection settings for better performance and scalability. Enhance transaction logging and add comprehensive load testing support in the Makefile.

Refactor locustfile to provide more robust and configurable load testing:
- Add dynamic configuration via environment variables
- Improve error handling and logging
- Implement realistic flow run simulation
- Add connection and timeout handling
- Support API key authentication
- Enhance stats tracking and error reporting
- Add `no_autoflush` context to prevent unnecessary database operations
- Change transaction logging error from exception to error level logging
- Simplify error handling in log_transaction function
Update project dependencies by adding Locust (version 2.32.9) to the development requirements, supporting load testing capabilities
…and scalability

- Increase default pool_size from 10 to 20 for better connection handling
- Adjust max_overflow to 40 to support higher concurrent connections
- Extend db_connect_timeout from 20 to 30 seconds
- Add pool_recycle and echo settings to db_connection_settings
- Enhance documentation for database connection settings, highlighting SQLite limitations
- Introduce comprehensive Locust load testing target with configurable parameters
- Support flexible testing scenarios with customizable users, spawn rate, and host
- Enable headless and interactive testing modes
- Add environment variable support for API key, flow ID, and other testing parameters
- Provide sensible default values for load testing configuration
- Remove RETRY_DELAY and MAX_RETRIES environment variables
- Simplify FlowRunUser configuration by eliminating unused retry settings
- Maintain existing wait time configuration for load testing
- Add mandatory validation for FLOW_ID environment variable
- Raise a clear ValueError if FLOW_ID is not provided
- Remove default flow ID to ensure explicit configuration
- Improve load testing configuration robustness
- Introduce `locust_request_timeout` parameter in Makefile
- Update locustfile to use configurable request timeout from environment variable
- Set dynamic connection and network timeout based on REQUEST_TIMEOUT
- Improve request handling with flexible timeout configuration
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 11, 2025
@@ -71,16 +71,15 @@ class Settings(BaseSettings):
"""If True, Langflow will run in development mode."""
database_url: str | None = None
"""Database URL for Langflow. If not provided, Langflow will use a SQLite database."""
database_connection_retry: bool = False
database_connection_retry: bool = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is possibly misleading; I think it only retries the initial connection when creating the schema / startup, not for subsequent requests during normal operation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 11, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Feb 17, 2025
Merged via the queue into main with commit e1fb900 Feb 17, 2025
35 of 36 checks passed
@ogabrielluiz ogabrielluiz deleted the updated-locus branch February 17, 2025 14:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
ignore-for-release lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants