aws-samples / bedrock-claude-chat

AWS-native chatbot using Bedrock + Claude (+Mistral)
MIT No Attribution
688 stars 232 forks source link

Fix: close browser after URL processing with Playwright #342

Closed edamame8888 closed 3 weeks ago

edamame8888 commented 4 weeks ago

*Issue #341

Description of changes:

This pull request enhances the resource management of our URL loading function by ensuring that Playwright pages are closed after processing each URL. It incorporates a page.close() statement within the URL processing loop and closes the browser with browser.close() at the end of the session. These changes prevent resource leaks and improve performance during bulk URL operations.

Changes:

edamame8888 commented 3 weeks ago

Performance Before & After

The memory being maxed out at 100% is the cause.

Before the improvement, the memory performance in Cloud Watch Insight was maxed out and the content retrieval never finished. After the improvement, memory performance improved and we confirmed that the embedding was completed in a short period of time.

https://github.com/aws-samples/bedrock-claude-chat/issues/341#issuecomment-2151090410

337038006-028eeee5-daf6-4960-a09d-8dadabce21ed
statefb commented 3 weeks ago

Thank you for the investigation with clear evidence! LGTM, thank you for your contribution!! @edamame8888

statefb commented 3 weeks ago

Merged v1 by #346