actor
I am new to elixir and i wanted to confirm one thing. Lets say i have a vps with 2GB RAM and 1 CPU core.
I have a csv file with 2,000,000 records. To process the csv file i need say 10 processes so that work is easier. This is how i imagine i can process the csv faster.
-
Write a program that breaks the csv in 1000 parts.
-
Process 2000 items with 1 elixir process since i have 10 processes.
Remember i have 1 CPU core. How many processes can i create in one cpu core?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #ai
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
As many as you like (almost as there are limits in the VM, but you can bump them up when you need). However remember that more processes do not equal faster processing (concurrency != parallelism), TBH often it can slow you down as you need to do context switching and you will loose cache locality (i.e. data you need to process will be removed from cache for new data that is needed which will result in delays).
So in case of processing single CSV file on single core machine I would go with single process, as it should be not only easier, but faster as well.
Qqwy
The number of processes you can make is not limited by the number of CPU cores. The number of processes that can actually run at exactly the same time, however, depends on the number of CPU cores. But it is not something you usually have to think about very deeply: Often, processes have to wait on IO (reading/writing files) or other calls to the operating system or external world. The scheduler knows when this happens, and uses that to switch to another process that currently is not waiting. So we usually run many more processes than CPUs, and end up with a system that is still much faster than having only at most the amount of processes as we have CPU cores.
In your case, many processes might work on the same file, which means they all have to wait on the same thing. Instead, it is more natural to have one process that extracts lines from this file, which passes it on to a pool of workers that work on each of the lines, which might pass it on to other workers if there is more work to be done, until at some point you reach a stage at which you want to combine the results, which probably means that you’re limited to a single process there again as well.
I highly suggest using a more higher-level library like Flow for this. It makes the hard decisions like ‘how many processes for each stage’ and ‘how to connect the stages’ for you (which you can fine-tune if you want, but the defaults are very sane).
actor
Thanks As relates the question of splitting a csv, into 10 parts and using processes on a single core, is it a guarantee that the work shall be done faster with processes.
I have tried using one process in java and its slow as slow can be.
actor
Thanks for the length explanation. If i have a csv, i want to create 1000 files with 2000 lines each. I shall then create a process for each file. is there something wrong in thinking or solving the problem that way?
hauleth
No, absolutely not.
If all you want is to quickly process medium sized CSV file then Elixir isn’t the best choice. Either use Pandas or use specialised tools like
xsv(written in Rust).actor
Why? According to elixir
Splitting and processing one file at a time seems like things wil move a long faster unless i dont understand what
means.
hauleth
The place where you miss the point is that you still have only one CPU. There is no magic that will allow you to run things concurrently on single CPU in this world. In general if you process linear data (like files) then there is no point in doing that in more processes (system processes) than there is cores in your CPU, in Erlang terms - it is not feasible to process streams of data in more processes than you have schedulers enabled in your system (and it makes no sense to run more schedulers in your system than you have physical cores).
So there is no magic in this world that will speed up that files processing by running processing in multiple threads on the single core.
actor
Thanks. I thought there was free lunch in this joint with the notion of processes. I don’t think then elixir offers any solutions to my specific problem.
dimitarvp
Your problem is absolutely solvable by Elixir – and I’d say with much less lines than many other languages.
But the benefits of the Erlang’s BEAM VM and the OTP itself will not shine on a single-core system, as @hauleth said.
In this particular case I’d only recommend you use Elixir if: (1) you want the code for that task to be yours and thus small and readable and (2) are willing to learn for a bit.
However, if you don’t insist on code ownership then I think it’s much wiser to find an external tool that does what you want and utilize that.
hauleth
No, there is no such as free lunch. You cannot eat two apples at the same time as you are limited by amount of mouths.
However as I said, check out
xsvas this is based on Andrew Gallant’s awesomecsvlibrary, that should be fast enough (at the end of article he test his code against this file which also has over 2M records).