Giter VIP home page Giter VIP logo

seastar-starter's Introduction

Seastar starter project

This project contains a small Seastar program and minimal cmake scaffolding. The example contains both coroutines and continuation passing style uses of Seastar.

Building

Install dependencies (assuming a recent verison of Ubuntu such as 22.04):

git submodule update --init --recursive
seastar/install-dependencies.sh
apt-get install -qq ninja-build clang

Configure and build:

CXX=clang++ CC=clang cmake -Bbuild -S. -GNinja
ninja -C build

Running

The sample program splits an input file into chunks. Each core reads a subset of the input file into memory and then writes this subset out to a new file. The size of the per-core subset may be larger than memory, in which case more than one subset per core will be generated.

First, generate some data. This command will generate around 200mb of data.

dd if=/dev/zero of=input.dat bs=4096 count=50000

Next, invoke the program. Here we limit the total system memory to 500 MB, use 5 cores, and then we further limit memory to 1% of the amount available on each core. Each command line argument is optional except the input file. If the amount of memory or the number of cores are not specified then the program will try to use all of the resources available.

$ ./main --input input.dat -m500 -c5 --memory-pct 1.0

The program should output a summary on each core about the data it is responsible for, and then once per second a per-core progress is printed.

INFO  2024-01-13 13:10:14,214 [shard 0] splitter - Processing 10000 pages with index 0 to 9999
INFO  2024-01-13 13:10:14,214 [shard 1] splitter - Processing 10000 pages with index 10000 to 19999
INFO  2024-01-13 13:10:14,214 [shard 3] splitter - Processing 10000 pages with index 30000 to 39999
INFO  2024-01-13 13:10:14,214 [shard 2] splitter - Processing 10000 pages with index 20000 to 29999
INFO  2024-01-13 13:10:14,214 [shard 4] splitter - Processing 10000 pages with index 40000 to 49999
INFO  2024-01-13 13:10:14,214 [shard 0] splitter - Progress: 0.0 0.0 0.0 0.0 0.0
INFO  2024-01-13 13:10:15,214 [shard 0] splitter - Progress: 54.5 54.3 55.2 53.8 53.6
INFO  2024-01-13 13:10:16,215 [shard 0] splitter - Progress: 100.0 100.0 100.0 100.0 100.0

After the program exists there should be a number of chunk files on disk. The chunk file format is chunk.<core-id>.<chunk-id>.

$ ls -l chunk*
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.0
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.1
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.10
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.100
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.101
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.102
-rw-r--r--. 1 user user 331776 Jan 13 13:10 chunk.core-0.103

Resources

Testing

This project uses a GitHub action to run the same set of instructions as above. Please see .github/workflows/build.yml for reference.

seastar-starter's People

Contributors

dotnwat avatar emaxerrno avatar mandelag avatar rockwotj avatar viliam-durina avatar

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.