The fun part is, if no one is making new tutorials/content because AI has removed all need for such people, what will the AI learn from for new things?!
I find the fixed height editing panels annoying e.g. editing the nginx config, or .env file. I have a tall screen, but it's limited to ½ the height of the window on my laptop, worse on the desktop... and it's not resizable.
Hi I made puretrack.io, in Laravel + clickhouse + mysql + redis + vue. Fun project, would build again. Need to track something? How about hundreds of things? You can use PureTrack.
Stats:
- Often has 10,000 tracking items updating every few seconds.
- Processed over 40 billion points total.
- Currently storing 3 billion track points.
- Nearly 9000 registered users, after 3 years.
- One main web server, one clickhouse server to store track data, one cache and database server, one worker server to help in busy periods.
Tricks for processing lots of data with PHP:
- Big batches are good.
- Queues are good.
- Caching is good.
- Clickhouse is very good.
- Redis is very good.
Basically it keeps as much as possible in memory to avoid touching disks.
The key difference is a .env shouldn't be in your repository, while all the PHP files are. Even if it wasn't intended for this use, it works very well. Each server can have it's own .env file, making it easy to use dev database on the dev server for example.
I've also found it very useful so other non-php scripts in the repository can all use the same .env file
I use Forge to manage my servers and Laravel apps, highly recommended. Handles all the cron jobs, networking etc for me. And you can still login to the servers easily and set up custom things if needed.
Stick it out with Laravel, it gets better and better. And every time I need something, they've already got a great solution for it. I'm now full on Laravel with Jobs, queues, notifications, eloquent, migrations etc... you can see what I've built with it here (plus Vue) https://puretrack.io
Start with Migrations and Eloquent I recommend, the nice thing about eloquent is you can do manual queries if you need to, but the basic stuff like selecting an item, updating a parameter, and saving it is so easy!
Thanks to the jobs queue and Laravel Forge, I was able to scale up from a single server to multiple servers with load balancer to handle a heavy load in less than a day. And I'm an amateur sys admin.
I had that for the first 18 years, but boy the last 2 are getting better :) no seriously I'm able to write most laravel code without too many errors now, but Javascript... boy
My strategy is simple: The database is a dumb store. I try and avoid putting code, logic or constraints into the database as much as possible. So never had them to need to delete :)
I use sublime for Laravel/Vue. It pretty much does everything mentioned in that 'very little' article. One other shortcut that's worth learning:
ctrl-cmd-g to select ALL of the selected item on the page. Goes great with cmd-d, but often you just want all on the page.
Sometimes I do wish it also had a side bar 'filter'. I realise cmd-p pretty much does it all anyway, but the advantage is you could leave the search there. (anyone know of an option/plugin for that?)
yes it's no more secure than cookies in the browser. Both can be saved by someone malicious and resent manually. The only security you can do is server based expiry of them. But keep in mind someone needs to get the API token or cookie first... This is why you have to be super careful using a public computer to login to your services, and logout again.
I've been using https://beszel.dev for basic server monitoring.
You can set up a receiver and host completely internally. And it's simple to do, and open source.
Because it's one or two commands to add and it's there. All your app building and testing can be built with auth working, which means you can actually publish a production ready product way faster. Obviously if you don't need auth, then don't add it :)
Yes the moment the data is received, I store it in redis in a queue. Originally I made a mistake and just sent the data directly into a 'job'. The problem with that is if a job fails, the data is cloned multiple times for each job attempt, thus you run out of RAM easily and it clogs up Laravel horizon. So critical when dealing with large amounts of data to store it (on disk or RAM), and just send an ID to access the data in the job.
The other advantage of that is I can check the queue size, and if it's too big I can start dropping data to avoid overloading the server. In my case if I get data once every 6 seconds instead of every 3, it doesn't matter too much.
I just use one pipeline to process the data. There would be a few ms difference between storing in redis and sending to clickhouse. Clickhouse also has its own buffer of about 1 second for inserts. It wouldn't really matter if they had a bigger gap e.g 5 seconds. The timestamp of each point is not the insert time, it's the time given in the data, so will be the same for both. The UI already loads the latest positions and the tracks in separate calls, so no problem if one comes in before another...
it's stored in Redis, which writes a snapshot to disk frequently. So if the server suddenly powered off it would reload to the state within about a minute. And the queue is normally cleared faster than 1 minute anyway...
Clickhouse is a columnar based database, so it's a bit different to row based databases like MySQL. Although the SQL to query it is much the same. The schema is pretty much what you might expect:
- object_id
- altitude
- lat
- long
- speed
- source_type
- extra_data as JSON
I have two tables, both 'materialized views', almost the same, except they are ordered by different things. The first thing a table is ordered by is literally how the data is split up on disk and indexed in clickhouse. So critical you get that right for what you want to pull out. e.g. one table is sorted (i.e. 'indexed') by object_id, so I can pull the track out of an object_id almost instantly. One is sorted by time, and has a geo index too, so I can select just a portion of the map at a specific time. They have an awesome YouTube channel with lots of videos about how it works: https://www.youtube.com/@ClickHouseDB/videos
- So all tracks and trails are pulled from the clickhouse database. It's amazing, and so fast :) Plus built in compression. With MySQL I had about 3 days of storage on a small server. Clickhouse gives me 3x that.
- The latest locations are all stored in Redis. So all the icons on the map, come from that.
- As data comes in, I do some basic conversions if needed (e.g. getting the units matching what I store) The data is stored temporarily in RAM and then a job to process it is dispatched.
- Each job runs the data through a pipeline. I have some pipes to deal with specific types of data e.g. "ADSB Pipe" and then many common pipes e.g. "calculate ground level", "save latest to redis" and "store in clickhouse".
Then just write queries to pull the data out as needed! Easy peasy ;) The downside of the pipeline as the data comes in approach is I can't easily reprocess the data.
One fun thing- if you click on a track, you'll see it loads all the aircraft AROUND that aircraft, at that point in time. That's thanks to clickhouse, it's so fast, as long as the tables are designed for what you want to pull out.
If you want to see a really impressive clickhouse demo, it's pulling all that data out and generating the graphics, live: https://adsb.exposed
Hi I've developed puretrack.io, a GPS tracking aggregation service. Designed originally for safety tracking of paraglider and glider pilots who use a huge variety of GPS tracking devices, from Satellite trackers to mobile apps. But can be used to track boats, vehicles, aircraft, NASA balloons, rockets, anything you like.
It currently sucks in or is pushed up to 15,000 devices every few seconds from 43 different sources. 6000 registered users so far. The site is free to use with a paid upgrade plan available for non-safety-critical features (like more maps).
Some specs:
- Built on Laravel / Vue / Redis, MySQL and Clickhouse.
- Job queuing up to 900 jobs/minute.
- Processed over 20 billion points now in 3 years.
- 1 main web server, 1 database server, and 1 helper server that has extra tools like Typesense and basic map hosting.
- Everything kept off disk as much as possible on the main server, just using Redis to load all live data from memory. Tracks are pulled from Clickhouse.
Happy to answer any questions about processing lots of data in PHP/Laravel.
I really enjoy working with Vue, and you can pry it out of my cold dead hands. I really don't want to learn a whole new system, and I'm sure I could get to grips with the basics pretty quick, but it's all the little details that take so long to figure out.
Sure Vue ecosystem is smaller than React, but I feel it's big enough to find almost everything I need. Enjoying vueuse for example more and more.
Interesting!
The fun part is, if no one is making new tutorials/content because AI has removed all need for such people, what will the AI learn from for new things?!
I find the fixed height editing panels annoying e.g. editing the nginx config, or .env file. I have a tall screen, but it's limited to ½ the height of the window on my laptop, worse on the desktop... and it's not resizable.
https://preview.redd.it/gmyyztinypvf1.png?width=1348&format=png&auto=webp&s=c377808ee9b07d912b35696b480656324da13cbf
Thank you!
Hi I made puretrack.io, in Laravel + clickhouse + mysql + redis + vue. Fun project, would build again. Need to track something? How about hundreds of things? You can use PureTrack.
Stats:
- Often has 10,000 tracking items updating every few seconds.
- Processed over 40 billion points total.
- Currently storing 3 billion track points.
- Nearly 9000 registered users, after 3 years.
- One main web server, one clickhouse server to store track data, one cache and database server, one worker server to help in busy periods.
Tricks for processing lots of data with PHP:
- Big batches are good.
- Queues are good.
- Caching is good.
- Clickhouse is very good.
- Redis is very good.
Basically it keeps as much as possible in memory to avoid touching disks.
The key difference is a .env shouldn't be in your repository, while all the PHP files are. Even if it wasn't intended for this use, it works very well. Each server can have it's own .env file, making it easy to use dev database on the dev server for example.
I've also found it very useful so other non-php scripts in the repository can all use the same .env file
I use Forge to manage my servers and Laravel apps, highly recommended. Handles all the cron jobs, networking etc for me. And you can still login to the servers easily and set up custom things if needed.
Stick it out with Laravel, it gets better and better. And every time I need something, they've already got a great solution for it. I'm now full on Laravel with Jobs, queues, notifications, eloquent, migrations etc... you can see what I've built with it here (plus Vue) https://puretrack.io
Start with Migrations and Eloquent I recommend, the nice thing about eloquent is you can do manual queries if you need to, but the basic stuff like selecting an item, updating a parameter, and saving it is so easy!
Thanks to the jobs queue and Laravel Forge, I was able to scale up from a single server to multiple servers with load balancer to handle a heavy load in less than a day. And I'm an amateur sys admin.
I had that for the first 18 years, but boy the last 2 are getting better :) no seriously I'm able to write most laravel code without too many errors now, but Javascript... boy
Fair enough!
Side note: I'm probably doing it all wrong :)
My strategy is simple: The database is a dumb store. I try and avoid putting code, logic or constraints into the database as much as possible. So never had them to need to delete :)
I'm sure I'm not using them as well as I could:
- Emmet
- GitGutter
- JSON Reindent
- Laravel blade
- LSP
- LSP-Tailwind
- LSP-Vue
- SideBarEnhancements
- Tailwind CSS Autocomplete
- Vue
I use sublime for Laravel/Vue. It pretty much does everything mentioned in that 'very little' article. One other shortcut that's worth learning:
ctrl-cmd-g to select ALL of the selected item on the page. Goes great with cmd-d, but often you just want all on the page.
Sometimes I do wish it also had a side bar 'filter'. I realise cmd-p pretty much does it all anyway, but the advantage is you could leave the search there. (anyone know of an option/plugin for that?)
yes it's no more secure than cookies in the browser. Both can be saved by someone malicious and resent manually. The only security you can do is server based expiry of them. But keep in mind someone needs to get the API token or cookie first... This is why you have to be super careful using a public computer to login to your services, and logout again.
I've been using https://beszel.dev for basic server monitoring.
You can set up a receiver and host completely internally. And it's simple to do, and open source.
Because it's one or two commands to add and it's there. All your app building and testing can be built with auth working, which means you can actually publish a production ready product way faster. Obviously if you don't need auth, then don't add it :)
Laravel Vue starter kit with user admin panel -> GitHub -> Laravel Forge -> Server. Done!
Having all the user authentication stuff and a database migration system is a great head start to plow into building the actual app.
Thanks!
The other advantage of that is I can check the queue size, and if it's too big I can start dropping data to avoid overloading the server. In my case if I get data once every 6 seconds instead of every 3, it doesn't matter too much.
it's stored in Redis, which writes a snapshot to disk frequently. So if the server suddenly powered off it would reload to the state within about a minute. And the queue is normally cleared faster than 1 minute anyway...
Clickhouse is a columnar based database, so it's a bit different to row based databases like MySQL. Although the SQL to query it is much the same. The schema is pretty much what you might expect:
- object_id
- altitude
- lat
- long
- speed
- source_type
- extra_data as JSON
I have two tables, both 'materialized views', almost the same, except they are ordered by different things. The first thing a table is ordered by is literally how the data is split up on disk and indexed in clickhouse. So critical you get that right for what you want to pull out. e.g. one table is sorted (i.e. 'indexed') by object_id, so I can pull the track out of an object_id almost instantly. One is sorted by time, and has a geo index too, so I can select just a portion of the map at a specific time. They have an awesome YouTube channel with lots of videos about how it works:
https://www.youtube.com/@ClickHouseDB/videos
Thank you! Great questions :)
- So all tracks and trails are pulled from the clickhouse database. It's amazing, and so fast :) Plus built in compression. With MySQL I had about 3 days of storage on a small server. Clickhouse gives me 3x that.
- The latest locations are all stored in Redis. So all the icons on the map, come from that.
- As data comes in, I do some basic conversions if needed (e.g. getting the units matching what I store) The data is stored temporarily in RAM and then a job to process it is dispatched.
- Each job runs the data through a pipeline. I have some pipes to deal with specific types of data e.g. "ADSB Pipe" and then many common pipes e.g. "calculate ground level", "save latest to redis" and "store in clickhouse".
Then just write queries to pull the data out as needed! Easy peasy ;) The downside of the pipeline as the data comes in approach is I can't easily reprocess the data.
One fun thing- if you click on a track, you'll see it loads all the aircraft AROUND that aircraft, at that point in time. That's thanks to clickhouse, it's so fast, as long as the tables are designed for what you want to pull out.
If you want to see a really impressive clickhouse demo, it's pulling all that data out and generating the graphics, live:
https://adsb.exposed
Hi I've developed puretrack.io, a GPS tracking aggregation service. Designed originally for safety tracking of paraglider and glider pilots who use a huge variety of GPS tracking devices, from Satellite trackers to mobile apps. But can be used to track boats, vehicles, aircraft, NASA balloons, rockets, anything you like.
It currently sucks in or is pushed up to 15,000 devices every few seconds from 43 different sources. 6000 registered users so far. The site is free to use with a paid upgrade plan available for non-safety-critical features (like more maps).
Some specs:
- Built on Laravel / Vue / Redis, MySQL and Clickhouse.
- Job queuing up to 900 jobs/minute.
- Processed over 20 billion points now in 3 years.
- 1 main web server, 1 database server, and 1 helper server that has extra tools like Typesense and basic map hosting.
- Everything kept off disk as much as possible on the main server, just using Redis to load all live data from memory. Tracks are pulled from Clickhouse.
Happy to answer any questions about processing lots of data in PHP/Laravel.
That's interesting thx. Funny I'd have thought 'stalled' is kind of a good thing. i.e. not changing dramatically is great!
I also kinda feel like they're all heading to eventually merge into the same thing at some stage :)
I really enjoy working with Vue, and you can pry it out of my cold dead hands. I really don't want to learn a whole new system, and I'm sure I could get to grips with the basics pretty quick, but it's all the little details that take so long to figure out.
Sure Vue ecosystem is smaller than React, but I feel it's big enough to find almost everything I need. Enjoying vueuse for example more and more.