Skip to content

Improved/performance and reliability#2

Open
AmanUllahYasir wants to merge 5 commits into
diorwave:mainfrom
AmanUllahYasir:improve/performance-and-reliability
Open

Improved/performance and reliability#2
AmanUllahYasir wants to merge 5 commits into
diorwave:mainfrom
AmanUllahYasir:improve/performance-and-reliability

Conversation

@AmanUllahYasir
Copy link
Copy Markdown

Performance Improvements

  • Reduced memory with message pagination
  • Cache decryptions for faster rendering
  • Improved broadcast performance with better locking
  • Faster session cleanup and validation
  • Added proper error logging

- Limit message history to last 50 messages by default
- Reduces memory usage and improves broadcast performance
- Added limit parameter to get_all() for flexibility
- Documents all 7 performance and reliability improvements
- Includes code examples and impact analysis
- Provides testing recommendations
- Lists future optimization opportunities
- reduce memory usage with message pagination
- faster broadcast with better locking
- cache decryptions and improve logging
- validate sessions and cleanup resources
Copy link
Copy Markdown

@KenBot117 KenBot117 left a comment

Choose a reason for hiding this comment

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

GenAI code PRs are ugly. This PR is not recommended.

I do recommended some of the error logging for troubleshooting but there are issues in this that will increase ram usage despite claims for improved performance. I don't use Python as much as I want to but it's easy to see obvious performance degradations that will happen with this version.

Comment thread cmd_chat/client/client.py
msg["text"] = decrypted
if "_decrypted_text" not in msg:
msg["_decrypted_text"] = self.room_fernet.decrypt(msg["text"].encode()).decode()
msg["text"] = msg["_decrypted_text"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This increases ram by saving data twice

while True:
with suppress(asyncio.CancelledError):
await asyncio.sleep(300)
await asyncio.sleep(60)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some connections might be too weak for short timeouts

snapshot = list(self.active_connections.items())

dead = []
for uid, ws in snapshot:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Logging might be nice for troubleshooting but not sure why the shift from user_id to uid

Comment thread IMPROVEMENTS_CHANGELOG.md
@@ -0,0 +1,244 @@
# Performance Improvements
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These are GenAI reports. Please provide real world testing

@KenBot117
Copy link
Copy Markdown

GenAI code PRs are ugly. This PR is not recommended.

I do recommended some of the error logging for troubleshooting but there are issues in this that will increase ram usage despite claims for improved performance. I don't use Python as much as I want to but it's easy to see obvious performance degradations that will happen with this version.

Now I see @diorwave removed logging 4 months ago. This PR is now easier to reject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants