These are the updates for the week of 2023/09/11.
We realized that we had a high-CPU consumption issue in our elixir app, which was unreasonable for the amount of work the app was doing. To make it easier to debug I added a series of tools to the project:
rexbug
: a tracing library that allows the code to be instrumented and detect calls to functions specified with module, name and arity. It can also include the stack trace for those detected calls.etop
a tool similar to htop but for elixir processes.eep
, a profiling library that instruments live production code and generates a profile of which processes or functions take the most CPU time.The library has the following easy to use interface:
LambdaEthereumConsensus.Profile.build()
It generates traces that can be read with QCachegrind and look like the following screenshot:
This was a confirmation of the ports discussions last week: we can't have NIFs with blocking calls. We'll need to move over to ports. For now, we decided to implement a quick work-aroudn with goroutines in the go side.
Built a proof of concept for LibP2P over ports, with a GenServer in elixir that owns the port, sends requests and receives notifications. This is the PR for it.
sequenceDiagram
participant gs as GenServer
participant cs as Go Command server
participant tg as Topic consumer goroutine
gs ->> cs: proto[SubscribeToTopicCommand]
cs ->> tg: Create goroutine
cs -->> gs: proto[OkResponse]
tg ->> gs: proto[TopicNotification]
This PoC doesn't actually do any LibP2P work but serves as a basis for the big refactor to come. It shows how to:
The code can be used as-is, replacing the contents of some functions to the libp2p code that we already have for the current NIF implementation.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing