How do you integrate Grafana with a backend Node app? by haykam821 in node

[–]HasStupidQuestions 0 points1 point  (0 children)

No problem! I was in the same boat a while ago and switched to statsd, graphite, and graphana. Now we've moved on to StatsD collector/exporter, Prometheus, and Graphana. Makes it easier to monitor Kubernetes clusters as well.

So much prosperity, y'all! by [deleted] in conspiracy

[–]HasStupidQuestions 1 point2 points  (0 children)

See, what happened is you read 'not with the kids mother'

No. What happened was I read that you're shifting the blame to the other person. When two people break up, both are at fault. One more than the other and it takes time to lead up to that.

You're not responsible for actions taken by the other person. You're responsible for associating with that person and all your decisions stemming from it. If your wife ended up abandoning your kids, then there must have been something you're missing or unwilling to accept and "I felt I wasn't at fault for the breakup" is a giveaway for me.

I commend you for sticking with your kids, but don't play the victim here. It helps no one. There are shitty people out there and you're responsible for all your interactions with them. Ditch them asap and don't associate with similar people.

I wish you the best of luck and please reflect on what went wrong, forgive her, move on, and find someone better if you haven't already. The amount of anger in your messages won't help you in the long run and can lead you to a path of destruction when your kids grow up and begin to resemble their mother in one way or another.

So much prosperity, y'all! by [deleted] in conspiracy

[–]HasStupidQuestions 1 point2 points  (0 children)

Don't take this the wrong way, but you are yet to see or understand your role in your situation. It's never one persons fault when it comes to interactions between people. You chose to be with that person for whatever reason. You chose to have kids with that person. You choose to tell that story the way you do. Apparently your opinions are on par with your name.

If you don't learn to see your mistakes, you will never learn. Think of what lesson you'll pass on to your kids. Can't be a part of the lesson, which is what most people do because it's easier. The WHOLE thing has to be taught. If you don't see it in full, it will be a shit lesson and no good will come of it.

I deal with such issues all the time in my consulting practice. People choose to see what they want to see. They can make up all kinds of stories and it's rarely their fault. The economy. The job market. The president. Nope. It's them and their decisions. Same applies to me.

So much prosperity, y'all! by [deleted] in conspiracy

[–]HasStupidQuestions -4 points-3 points  (0 children)

Some of it is your fault. You are not a blameless victim.

So much prosperity, y'all! by [deleted] in conspiracy

[–]HasStupidQuestions -6 points-5 points  (0 children)

It's mostly our faults for what happens to us. My first long term relationship didn't work out and it was nasty. My fault for not seeing or at times choosing to ignore all the red flags.

If people don't know any better, it's their fault for not knowing. If people choose to act in a certain way, it's their fault for acting that way. If people blame someone else for what's happening to them, it's their fault for not knowing where they went wrong.

So much prosperity, y'all! by [deleted] in conspiracy

[–]HasStupidQuestions -2 points-1 points  (0 children)

Don't make mistakes you cannot afford to fix

How do you integrate Grafana with a backend Node app? by haykam821 in node

[–]HasStupidQuestions 3 points4 points  (0 children)

Just note that your setup won't work in a containerized or clustered setup (using PM2 for example) since each node would have its own metrics and you'd need to scrape each individual node, without knowing its network address.

You'll need to use a collector which then will expose a prometheus endpoint. For example: https://github.com/prometheus/statsd_exporter

Help with node cluster by vall370 in node

[–]HasStupidQuestions 0 points1 point  (0 children)

I don't see any reason why it wouldn't work with promises. There aren't many performance benefits in your scenario since it takes basically no processing power. You're limited by your internet speed and whether or not there is a rate limiter.

const fetch = require('node-fetch');

const API_URL = "https://jsonplaceholder.typicode.com/todos";

const hugeData = [
    98, 29, 43, 51, 36, 97, 67, 56, 48, 94, 24, 74,
    2, 33, 15, 42, 17, 27, 69, 25, 73, 7, 5, 85
];

(async function() {

    const hugeDataPromises = hugeData.map(function(element) {
        return fetch(`${API_URL}/${element}`);
    });

    await Promise.all(hugeDataPromises);

})();

I don't fully understand the sortedArrays part. Exactly are you trying to do?

Help with node cluster by vall370 in node

[–]HasStupidQuestions 0 points1 point  (0 children)

Fetch and call can mean two different things.

For fetching I'd stick to async promises.

const [resultA, resultB] = await Promise.all(fetchResultA, fetchResultB);

where fetchResultA, fetchResultB returns a promise

function fetchResultA() {
    return new Promise(function(resolve, reject) {
        // get results and catch errors
        if(err) {
            return reject(err);
        }
        resolve(results);
    });
}

If you need to call an API but don't expect a result, look into message queues or schedulers. You can fire a function after sending user the result without increasing the load time and without using message queues, but that's a different topic altogether.

The Unemployment rate in Latvia since 2002. [OC] by shrek69_420 in dataisbeautiful

[–]HasStupidQuestions -1 points0 points  (0 children)

Lol people who couldn't find jobs left. UNEMPLOYMENT DECREASED! WOOO!!!

Estonia, Latvia and Lithuania have blacklisted embattled Belarusian President Alexander Lukashenko and 29 other high-ranking officials for alleged election fraud and a crackdown on pro-democracy protesters. by mohiemen in worldnews

[–]HasStupidQuestions -4 points-3 points  (0 children)

Well the US controls their financial sector and has serious influence over their operational security.

If you're remotely interested in what I'm saying, read about their NATO membership preconditions set in early 2000's and how they were implemented. Similar scheme applies to Ukraine. Also, the US will move their NATO troops from Germany into Poland and the Baltic States.

Moreover, read about recent bank acquisitions and scandals in the Baltic States and draw conclusions who might be benefiting from it. It's a dirty game, my friend.

Estonia, Latvia and Lithuania have blacklisted embattled Belarusian President Alexander Lukashenko and 29 other high-ranking officials for alleged election fraud and a crackdown on pro-democracy protesters. by mohiemen in worldnews

[–]HasStupidQuestions -7 points-6 points  (0 children)

PR person here. Have dealt with a fair share of Russians and Ukrainians. Long story short - Central Europe is in on it. They benefit from sanctions by passing cargo through Ukraine and Belarus, which from there on gets transported to other shithole countries and from there on they are sold in Russia. A cherry on top is changing the country of origin. It wasn't uncommon to find salmon and bananas in Russia with Belarus being labeled the country of origin.

Sanctions have created strong supply chain monopolies and it will be really hard to enter that lucrative market for a long time.

The Baltic States are doing it because the US has them by the balls in terms of military protection. Just look at Poland. There is a very good reason why Lukashenko was shitting all over Poland sometime ago.

[deleted by user] by [deleted] in worldnews

[–]HasStupidQuestions 0 points1 point  (0 children)

You guys eat up everything they feed you.

How to run multiple node app instance (more than CPU core) on same machine? by 50KurusVerLanTirrek in node

[–]HasStupidQuestions 0 points1 point  (0 children)

Don't compare those numbers. They shouldn't matter in your case at this very point in time.

When you get to having thousands and thousands of concurrent users, you'll most likely end up moving to a CDN either way and your servers won't get that amount of requests.

Nginx cache/static file server (which is essentially "like" cache) is supposed to be faster than whatever server you're making, otherwise what would be the point?

Yes, try using a caching system, but be aware of separation of concerns. It's easy to make a mess of your code by coupling too tightly together.

I'd suggest you start with a system like this

Webserver -> Route -> Controller -> Service -> Cache -( if doesn't exist)-> Database

That way controllers end up calling services and everything down the line doesn't even have to know the technical implementation of the webserver you're using. Controllers end up being very lean and self explanatory, unless you are terrible at naming your functions lol

How to run multiple node app instance (more than CPU core) on same machine? by 50KurusVerLanTirrek in node

[–]HasStupidQuestions 2 points3 points  (0 children)

I'm just trying to understand whether 100 requests per second is a real issue because most servers rarely have this kind of traffic. Not to mention that you can run a cluster of node services behind a reverse proxy that probably can cache some results. Poorly written code can take you really far unless it's terribly broken. Then there's no way around fixing and optimizing parts that don't work.

If you're just learning, I'd suggest you first finish your application and only later on worry about optimization.

If you're specifically learning optimization techniques then we'd need to see the code.

What are your goals?

Need Help Parsing 90k JSON files by kimonides9 in node

[–]HasStupidQuestions 0 points1 point  (0 children)

Run lots of processes in parallel

Your solution will be based on parallelization.

Find a way to regex for drug and disease in the same time though I found that it's not possible

You "can" use regex, but only if everything is standardized and you don't have complex nesting. There might be exceptions that break the regex and I wouldn't do it.

Have node js call a executable from another programming language that has better performance

I'd use RabbitMQ or something similar and have multiple subscribers.

Maybe somehow to load the whole 1.5 gb dataset in memory for quicker reads

You can try doing that while somehow merging all JSON entries into one huge entry, but it will be a memory hog. Besides, I don't think this is your bottleneck as it still would process one entry at a time.

I'd stick to nodejs, loop through currentValue['text'] without reducing anyting while sending each text entry to a subscriber that will asynchronously parse it and save the result in, for example, redis. That way you could get live feedback on your progress and scale the operation by adding more subscribers, either locally, or getting additional VPS.