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

Colocation tasks before production #1672

Closed
21 of 23 tasks
cowfee opened this issue Jul 11, 2023 · 1 comment
Closed
21 of 23 tasks

Colocation tasks before production #1672

cowfee opened this issue Jul 11, 2023 · 1 comment
Assignees
Labels
E:3.1 Driver Colocation See https://github.com/cowprotocol/pm/issues/14 for details

Comments

@cowfee
Copy link
Contributor

cowfee commented Jul 11, 2023

Before Staging

Before Production

After Production (Cleanups)

cowfee added a commit that referenced this issue Jul 18, 2023
Progress on #1672.

Sort orders in the driver by likelihood of fulfillment before passing
them to the solver.

### Test Plan

Added an automated test.
sunce86 added a commit that referenced this issue Aug 8, 2023
Progress on #1672

Fixes #1614 (solver
competition part, since observations part is done).
sunce86 added a commit that referenced this issue Aug 11, 2023
MartinquaXD added a commit that referenced this issue Aug 28, 2023
Progress on #1672.

Filters orders based on trader balances. If the traders don't have
enough balance to cover the order, it will be removed before being sent
to the solver.

TODO after merging:
- Configure ethflow address in infra.
- Extend the test.

### Test Plan

Added automated test.

---------

Co-authored-by: Valentin <[email protected]>
Co-authored-by: Martin Beckmann <[email protected]>
Co-authored-by: Martin Beckmann <[email protected]>
fleupold added a commit that referenced this issue Oct 9, 2023
# Description
When giving production traffic to the colocated setup, we noticed a lot
of price estimators (even fast ones like baseline) getting rate limited
frequently. This is due to the driver requesting liquidity for the most
recent block and blocking on fetching it if it's not available. For the
legacy setup, there was a code path specifically for quotes, allowing to
use a "recent" instead of the latest block for fetching liquidity.

This PR recreates this path for the co-located setup

# Changes
<!-- List of detailed changes (how the change is accomplished) -->

- Adds a flag to the liquidity fetcher indicating whether stale
liquidity is allowed
- If this flag is set, quote for _recent_ instead of _latest_ block
(which should already be cached)

## How to test
Run this benchmark script against before and after:

```sh
SECONDS=0 
while (( SECONDS < 60 )); do
  time curl -H 'content-type: application/json' --data '{"from": "0xc3792470cee7e0d42c2be8e9552bd651766c5178","buyToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","sellToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","kind": "sell","sellAmountAfterFee": "100000000000000000", "quality":"optimal"}' http://localhost:8080/api/v1/quote
done
```

observe http://localhost:11088/metrics in both cases and look for
liquidity cache hits:

Before:
```
driver_recent_block_cache_hits{cache_type="uniswapv2"} 34300
driver_recent_block_cache_misses{cache_type="uniswapv2"} 840
```

After
```
driver_recent_block_cache_hits{cache_type="uniswapv2"} 39200
driver_recent_block_cache_misses{cache_type="uniswapv2"} 140
```

Note that we now only have 1 cache miss (140 pools) on cold start vs 1
cache miss on each new block and higher overall throughput

## Related issues
#1672

---------

Co-authored-by: Nicholas Rodrigues Lordello <[email protected]>
@mfw78 mfw78 added E:3.1 Driver Colocation See https://github.com/cowprotocol/pm/issues/14 for details and removed colocation labels Oct 12, 2023
@fleupold fleupold assigned fleupold and sunce86 and unassigned nlordell and cowfee Oct 12, 2023
@fleupold
Copy link
Contributor

Closing this in favor of cowprotocol/pm#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:3.1 Driver Colocation See https://github.com/cowprotocol/pm/issues/14 for details
Projects
None yet
Development

No branches or pull requests

6 participants