Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

PR 397.1 #4066

Merged
merged 5 commits into from
Mar 26, 2025
Merged

PR 397.1 #4066

merged 5 commits into from
Mar 26, 2025

Conversation

HarshModi2005
Copy link

@HarshModi2005 HarshModi2005 commented Mar 25, 2025

Relates to

Issue #397.1:Load Testing Agents at Scale

Risks

Low. This PR introduces load testing infrastructure that simulates high volumes of concurrent agent interactions. Risks include:

  • Potential resource consumption during test runs
  • Test environment isolation requirements

Background

What does this PR do?

Implements a load testing framework to simulate agent interactions in social environments at various scales (2-1000+ agents). The system measures performance metrics, stability, and error rates to determine system breaking points and scalability thresholds.

What kind of change is this?

Features (non-breaking change which adds functionality)

Documentation changes needed?

My changes require a change to the project documentation to explain how to run and interpret load tests.

Testing

Where should a reviewer start?

  1. packages/the-org/src/loadTest/index.ts - Main implementation
  2. packages/the-org/src/loadTest/test-runner.js - Test execution logic
  3. packages/the-org/src/loadTest/types.ts - Type definitions
  4. packages/the-org/src/loadTest/service.ts - Supporting services

Detailed testing steps

  1. Run small-scale test (2 agents):

    cd packages/the-org
    npm run load-test -- --scale=small
    
    • Verify output logs in logs/ directory
    • Confirm performance metrics are captured
  2. Run medium-scale test (10-50 agents):

    npm run load-test -- --scale=medium
    
    • Check system resource utilization remains below 70%
    • Verify error rates stay below 1%
  3. For large-scale tests (100+ agents), use dedicated environment:

    npm run load-test -- --scale=large --environment=staging
    
    • Monitor for memory leaks or performance degradation

Copy link
Contributor

coderabbitai bot commented Mar 25, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wtfsayo wtfsayo assigned wtfsayo and unassigned wtfsayo Mar 25, 2025
@wtfsayo wtfsayo self-requested a review March 25, 2025 15:59
@wtfsayo wtfsayo added the V2 Eliza 0.2.0 label Mar 25, 2025
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

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

Overall this looks great added some comments mainly around configurability but logic itself looks good.

The logs are super useful thanks for adding them

https://drive.google.com/drive/folders/1_qRS8XMCEyFXB4wSqQRsRe6S5E9PIgMu

// Create a header for the main log file
fs.writeFileSync(
mainLogFile,
`AGENT SCALABILITY ANALYSIS\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's make this a single JSX string instead of multiple and make this a function in a utils file taking in the data as params that way if we have other scaling tests we can reference this

console.log('Starting Agent Scalability Analysis');
console.log(`Log file: ${mainLogFile}`);
console.log('-------------------------------------');

Copy link
Collaborator

Choose a reason for hiding this comment

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

elizaLogger everywhere

// Add visualization hint
fs.appendFileSync(
mainLogFile,
`\n\nVISUALIZATION\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

// If tests fail, still save the output and error
fs.appendFileSync(
mainLogFile,
`\n\nERROR DURING TESTING:\n` +
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here re adding to util and using here


// Write header to summary file
fs.writeFileSync(summaryLogFile,
'Scale Testing Summary - Finding Breaking Points\n' +
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here re making this a util

const metrics = await this.runSequentialLoadTest(runtime, config);

// Check if this is a breaking point (high error rate or very slow responses)
if (metrics.errorCount > 0.2 * metrics.messagesSent ||
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 a great addition - let's make these thresholds configurable / easier to discern by making this a constant and also consider running the load tests 3 with 3 different configurations of it i.e. with 3 thresholds like HIGH, MED, LOW and thresholds configured accordingly. That way in a single run we can see BREAKING POINT IDENTIFIED WITH HIGH THRESHOLD(details of thresholds), BREAKING POINT IDENTIFIED WITH MID THRESHOLD (details) , BREAKING POINT IDENTIFIED WITH LOW THRESHOLD (thresholds) lmk if you have any questions


// Write summary conclusion
fs.appendFileSync(summaryLogFile,
'\n\nSCALABILITY ANALYSIS\n' +
Copy link
Collaborator

Choose a reason for hiding this comment

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

in util

} catch (error) {
breakingPointIdentified = true;
logger.error(`BREAKING POINT: Error running test for ${config.description}:`, error);
fs.appendFileSync(detailedLogFile,
Copy link
Collaborator

Choose a reason for hiding this comment

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

^^

// Check memory periodically during participant creation
if (i % 100 === 0) {
const currentMemory = process.memoryUsage().heapUsed / 1024 / 1024;
if (currentMemory > 1024) { // If memory usage exceeds 1GB
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's make this configurable

}

// Add early breaking point detection
if (responseTime > 5000) { // If any single response takes > 5 seconds
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

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

LGTM thanks for addressing comments

@monilpat monilpat merged commit ca67273 into elizaOS:v2-develop Mar 26, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 Eliza 0.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants