Giter Club home page Giter Club logo

Comments (8)

dosubot avatar dosubot commented on September 28, 2024 3

To address the issue of the Langflow UI getting stuck on the loading page while running multiple flows, you can try the following steps to optimize performance:

  1. Increase Worker Processes: Increase the number of worker processes to handle multiple flows concurrently.

    langflow run --workers 4

    Or set the LANGFLOW_WORKERS environment variable:

    export LANGFLOW_WORKERS=4
  2. Use In-Memory Cache: Switch to using an in-memory cache for better performance.

    langflow run --cache InMemoryCache

    Or set the LANGFLOW_LANGCHAIN_CACHE environment variable:

    export LANGFLOW_LANGCHAIN_CACHE=InMemoryCache
  3. Adjust Worker Timeout: Increase the worker timeout to ensure that processes have enough time to complete.

    langflow run --timeout 120
  4. Enable Logging: Set the logging level to monitor performance issues and identify potential bottlenecks.

    langflow run --log-level info

    Or set the LANGFLOW_LOG_LEVEL environment variable:

    export LANGFLOW_LOG_LEVEL=info

Additionally, consider upgrading to a version of Langflow after 1.0.5, as there have been performance improvements and bug fixes related to running multiple flows in subsequent versions [1].

Example command to run Langflow with optimized settings:

langflow run --workers 4 --cache InMemoryCache --timeout 120 --log-level info

These steps should help mitigate the issue of the UI getting stuck on the loading page when running multiple flows.

To continue talking to Dosu, mention @dosu.

from langflow.

dosubot avatar dosubot commented on September 28, 2024 3

Yes, you can configure these settings in the .env file. After making these configurations, you need to restart Langflow for the changes to take effect.

Here are the relevant environment variables you can set in the .env file:

# Worker processes
LANGFLOW_WORKERS=4

# Cache type
LANGFLOW_LANGCHAIN_CACHE=InMemoryCache

# Worker timeout in seconds
LANGFLOW_TIMEOUT=120

# Logging level
LANGFLOW_LOG_LEVEL=info

After updating the .env file, restart Langflow to apply the changes [1][2][3].

To continue talking to Dosu, mention @dosu.

from langflow.

dosubot avatar dosubot commented on September 28, 2024 2

Yes, you can configure these settings in the .env file. After making these configurations, you need to restart Langflow for the changes to take effect.

Here are the relevant environment variables you can set in the .env file:

# Worker processes
LANGFLOW_WORKERS=4

# Cache type
LANGFLOW_LANGCHAIN_CACHE=InMemoryCache

# Worker timeout in seconds
LANGFLOW_TIMEOUT=120

# Logging level
LANGFLOW_LOG_LEVEL=info

After updating the .env file, restart Langflow to apply the changes [1][2][3].

To continue talking to Dosu, mention @dosu.

from langflow.

dosubot avatar dosubot commented on September 28, 2024 2

Yes, the use of SQLite could be causing the issue where you can't run multiple flows in parallel in Langflow. SQLite has limitations with concurrent write operations, which can lead to database locks and prevent parallel execution of flows.

A potential solution is to switch to a more robust database system that supports better concurrency, such as PostgreSQL or MySQL. This would allow multiple flows to run in parallel without encountering the same locking issues.

Here is an example of how you might configure SQLAlchemy to use PostgreSQL instead of SQLite:

from sqlmodel import SQLModel, create_engine, Session

# Replace the SQLite URL with a PostgreSQL URL
DATABASE_URL = "postgresql://user:password@localhost/dbname"

engine = create_engine(DATABASE_URL)

def session_scope():
    session = Session(engine)
    try:
        yield session
    finally:
        session.close()

# Ensure that your models and session management use the new engine
SQLModel.metadata.create_all(engine)

Additionally, Langflow's DatabaseService class can be configured to use PostgreSQL:

class DatabaseService(Service):
    name = "database_service"

    def __init__(self, settings_service: "SettingsService"):
        self.settings_service = settings_service
        if settings_service.settings.database_url is None:
            raise ValueError("No database URL provided")
        self.database_url: str = settings_service.settings.database_url
        self.engine = self._create_engine()

    def _create_engine(self) -> "Engine":
        settings_service = get_settings_service()
        connect_args = {}
        try:
            return create_engine(
                self.database_url,
                connect_args=connect_args,
                pool_size=self.settings_service.settings.pool_size,
                max_overflow=self.settings_service.settings.max_overflow,
            )
        except sa.exc.NoSuchModuleError as exc:
            if "postgres" in str(exc) and not self.database_url.startswith("postgresql"):
                self.database_url = self.database_url.replace("postgres://", "postgresql://")
                logger.warning(
                    "Fixed postgres dialect in database URL. Replacing postgres:// with postgresql://. To avoid this warning, update the database URL."
                )
                return self._create_engine()
            raise RuntimeError("Error creating database engine") from exc

    def get_session(self):
        with Session(self.engine) as session:
            yield session

By configuring the DatabaseService to use PostgreSQL, you can leverage its better concurrency support to run multiple flows in parallel in Langflow [1][2][3].

To continue talking to Dosu, mention @dosu.

from langflow.

Warit314 avatar Warit314 commented on September 28, 2024

@dosu can i config these in the .env file . Do i need to restart langflow after config?

from langflow.

Warit314 avatar Warit314 commented on September 28, 2024

i still can't run other flow in paralell? is it because of sqlite? is there a solution to this?

from langflow.

carlosrcoelho avatar carlosrcoelho commented on September 28, 2024

@Warit314

Could you please share your flow?

from langflow.

Warit314 avatar Warit314 commented on September 28, 2024

@carlosrcoelho
355_Llama3.1_Demo.json

It's just a LLama 3.1 flow that makes API calls to VLLM. I've been running this flow through the LangFlow backend API three times simultaneously.

from langflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.