Code Monkey home page Code Monkey logo

beetle's Issues

ctl: option to group and configure rpc endpoints to watch

I'm looking into leveraging iroh-ctl as a hub to report on some stats, for that it would be ideal if I could list and tag different RpcClientConfig so that it watches over all of them. Ideally I could do aggregate result vs per tag/namespace/somekey.

ie iroh-ctl status --watch --cfg=./mycfg.[toml|yaml|json] & iroh-ctl status --watch --tag=node_omega --cfg=./mycfg.[toml|yaml|json]

If we had this, I'd be happy to add an option to run --with-metrics so that it reports some sort of uptime metric. Useful for a central health/uptime monitoring solution.

expand bitswap test suite

  • multiple providers (all have the content)
    • make sure cancels are sent out
  • multiple providers (some are not dialable)
    • make sure content is fetched & failed dials are cleaned up
  • no dialable providers
    • make sure the request times out
  • benchmarks
    • 1-1 transfer on the same machine, (msg sizes: 128, 256, 4KiB, 16KiB, 512KiB 1MiB, 2MiB)

fix windows build

The current windows actions environment runs out of disk space.
Either use hacks to remove stuff from the environment on each run or self host runners.

metrics: check performance of trace collector

We're starting to see OpenTelemetry trace error occurred. cannot send span to the batch span processor because the channel is full which is usually the result of performance limitations on the collector side.

Deploy Iroh gateway to the cloud

The gateway must be deployed to the cloud:

  • need AWS accoutn attached to a n0 credit card
  • need a strategy for deploying, ideally hooked into CI

metrics dashboards

Metrics dashboards need to be updated with the latest knowledge and metrics.
Ops game needs to be improved - propper auth, backups, configuring storage, retention policies, rollups etc.
Add new dashboards: libp2p, dht, storage

fix automated deployments

  • gateway needs updated config & depends on storage/p2p
  • p2p needs to be added to the list of services and configured
  • storage needs to be added to the list of services and configured

gateway(unixfs): improve dir listing

Dir listing is very plain. We should list size where possible, breadcrumbs to parent, potentially resolve paths to list items.
Improve overall template styling, add execution time.

basic CLI for gateway, storage, and network processes

Must be able to launch the gateway, network, & storage processes via the command line.

Should be able to add configuration that allows each of the three processes to know about each other, using a config that specifies what address that process should be listening on, and the addresses of the processes to which it should connect.

gateway(streaming): handle streaming errors

Streaming content from the gateway is set up for the happy path. Breaking the connection or anything along the lines just errors out. Ideally we should track those requests, add metrics & handle errors better.

clean up gateway

Gateway is half baked right now and needs some love on putting the resolver in the right place, adding metrics and cleaning up the client.

feat: implement car file importing

We already have iroh-car to read car files, so now this needs to be hooked up through the cli so we can ingest large files of data into the store.

improve error handling

Currently error handling is pretty scattered and we have lots of unchecked unwraps etc.

take 2nd pass on metrics

We've got the basic building blocks in place however many pieces are either not instrumented, don't have counters or lose the trace context between internal over the wire calls.

gateway & p2p improvements

Currently many requests go and invoke fetch_bitswap with an empty provider list (ref trace ID 2b90b66cb34b936f005cde120d35de0e). We should fail fast here and return 404 or something similar.

The response from the resolver on gateway should be a stream, both to avoid loading everything into memory and significantly reduce the time to first byte which is currently t(fetch_bitswap) + some_overhead while it could be t(fetch_bitswap_first_byte) + some_overhead. This also allows us to return metrics like time to first byte/block, latency vs time etc.

feat(p2p): always connected peers

We should have a set of peers (configurable size) that we store in memory, as main peers. These can be used to send bitswap requests to, as well as improve general connectivity.

metrics ops

Ops game needs to be improved - propper auth, backups, configuring storage, retention policies, rollups etc.

feat: RPC/IPC for network and gateway processes

Create RPC client & network server implementations/

The goal is to have something like this run:

    async fn main() {
        let client = iroh_rpc_client::new().await.unwrap();
        let c = client.close();
        let task = tokio::spawn(|| async move { c.run().await; });

        let my_bytes = client.network.get("foobar").await.unwrap();
        println!("mybytes: {:?}", my_bytes);

        task.join().await.unwrap();
    }

Crates:

  • iroh-rpc
  • iroh-rpc-client
  • iroh-rpc-network
pub mod rpc {
    //! equivalenet to grpc or jsonrpc_v2
    //!
    //! - manages libp2p node
    //! - manages addresses
    //! - manages serialization
    //! - manages all internal comms

    pub struct Client {
        server: Libp2p,
        config: ClientConfig,
    }

    pub struct Server {
        server: Libp2p,
        config: ServerConfig,
        client_config: ClientConfig,
        state: State<T>
        router: R
    }
}

pub mod iroh_rpc_client {
    pub fn client_config() -> rpc::ClientConfig {
        rpc::ClientConfig::new()
          .with_namespace("db", |db| {
              db.with_method("get", crate::db::get)
          })
          .with_namespace("network", |n| {
              n.with_method("get", crate::network::get)
          })
    }

    pub fn new() -> Client {
        rpc::Client::with_config(client_config())
    }

    mod db {
        pub async fn get(cid: Cid) -> Result<()> {
            make_stream_request(DbRequest::Get(cid))
        }
    }

    mod network {
        pub async fn get(cid: Cid) -> Result<()> {
            make_stream_request(NetworkRequest::Get(cid))
        }
    }
}


pub mod iroh_network {
    // /network/get
    fn new_rpc_server(server_state: NetworkState) -> rpc::Server {
        let server = rpc::Server::new()
          .with_state(server_state)
          .with_namespace("network", |n| {
              n.with_method("get", network::get)
          })
          .with_client_config(iroh_rpc_client::client_config());
        server
    }

    mod network {
        pub async fn get(state &NetworkState, cid: Cid) -> Result<Bytes> {
            let result = state.get_cid(cid).await;
            result
        }
    }
}

pub mod iroh_db {
    // /db/get
    fn new_rpc_server(db_state: DbState) -> rpc::Server {
        let server = rpc::Server::new()
          .with_state(server_state)
          .with_namespace("db", |n| {
              n.with_method("get", db::get)
          })
          .with_client_config(iroh_rpc_client::client_config());

        // we can now make requests: server.client().namespace("db").call("get", "foobar").await;
        server
    }

    mod db {
        pub async fn get(state &DbState, cid: Cid) -> Result<Bytes> {
            let result = db.get(cid).await;
            result
        }
    }}

pub mod iroh_cli {
    async fn main() {
        let client = iroh_rpc_client::new().await.unwrap();
        let c = client.close();
        let task = tokio::spawn(|| async move { c.run().await; });

        let my_bytes = client.db.get("foobar").await.unwrap();
        println!("mybytes: {:?}", my_bytes);

        task.join().await.unwrap();
    }
}

iroh-lb

We should start working on a load balancer for the gateway.
It's still early to have real use for it but it's much easier to evolve and grow with us.
Reasons to do it:

  • we already have 2 gateways up, I'd love to have seamless handoff between the two
  • puts us up on the stall to work on the "real stuff" from day 1
  • should be easy enough to get started

Why not use something off the shelf

  • I can se us getting into the weeds with this: I'd love to work on supporting % rollouts, feature flagging on the gateway level, failover mechanics, geo based balancing, rtt based balancing, contention based etc... Don't think anything of the self will give us enough flexibility

gateway(cache): improve cache control headers

Our header logic for cache control is very crude. Either we say to the browser to cache forever if it's a ipfs/CID or simply set the Last-Modified header to now().

We should explore cache logic around ipns/dns TTLs, content publishing timestamp for Last-Modified

metrics: iroh-store

  • the store binary needs to be hooked up the metrics
  • the store itself should record metrics about its usage, including stats from rocksb

feat: rpc types, server, & client for `store` process

  • Add types/methods for in iroh-rpc-types:
    put
pub async fn put<T: AsRef<[u8]>, L>(&self, cid: Cid, blob: T, links: L) -> Result<()>
    where
        L: IntoIterator<Item = Cid>

get

pub async fn get(&self, cid: &Cid) -> Result<Option<DBPinnableSlice<'_>>>

get_links

pub async fn get_links(&self, cid: &Cid) -> Result<Option<Vec<Cid>>>
  • add store.rs client & associated methods
  • add iroh-rpc-store::rpc mod that can create a store specific server & knows how to respond to rpc requests
  • add rpc_addr to the store Config
  • run StoreServer rpc in mainso we can communicate with the store.
  • add missing p2p rpc commands

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.