Live data from Hacker News

Microservices - 72 resources

blog.arkency.com

31–40 of 48 posts

Re: Microservices - 72 resources

#31
post #22
post #12

Are people typically building their microservices infrastructure on top of a SQL database, or other datastores? I'd be concerned not just about the overhead of managing lots of different (though simple) services, but also the fact that you give up a lot of convenient & useful features that you could get for free with a monolithic application, such as transactions. You either have to avoid needing transactions between…

Transactions spanning several microservices violate their autonomy - one service should not lock resources of another. Jeppe Cramon explains it pretty well in http://www.tigerteam.dk/2014/micro-services-its-not-only-the...

That's often not practical. Say you're a shop front.

If you have a goods purchase service and a goods delivery service, you want to reserve the good (limited quantity) and reserve a time slot for transport (limited number of deliveries a day) before you charge the customer, and make the "commit".

And if you'd merge two separate companies into one uber-service, you've just created more problems than you've solved.

Re: Microservices - 72 resources

#32
post #23

One issue I have with this and similar architectures is that it often sticks an HTTP stack where it is not needed. The HTTP request/response paradigm does add a useful process management architecture, but it seems like you could implement that without the HTTP component, although then you would also need to figure out the inter-operability side of things if you wanted that flexibility to plugin into stuff. Which may…

Request/Reply pattern makes a poor choice for communication between services - it increases coupling. It doesn't matter much if it comes with HTTP or any other flavour. Again, Jeppe nails it in very detailed post: http://www.tigerteam.dk/2014/microservices-its-not-only-the-...

I feel somewhat petty for this complaint as the content is good, but I found that link almost unreadable. It felt like someone awkwardly shouting random words in sentence, having every other word wrapped in .

If anyone else finds this, here's a quick thing to paste into the developer console to make it more readable (the content is worth it):

    var jq = document.createElement('script');
    jq.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
    document.getElementsByTagName('head')[0].appendChild(jq);
    $("strong").each(function(i,e) {$(e).replaceWith($("" + e.innerHTML + ""))})

Re: Microservices - 72 resources

#33
post #27

What do people recommend for learning about SOA / microservices? I liked Patterns of Enterprise Application Architecture and Enterprise integration patterns, but didn't have a great experience with the SOA design with Rails book - it felt much to focused on very basic details (e.g., here is how you consume JSON).

If I could recommend _just_one_ resource from that list, it would be http://www.tigerteam.dk/talks/IDDD-What-SOA-do-you-have-talk...

[deleted]

Re: Microservices - 72 resources

#34
post #9

Earlier quoted context omitted.

You can install a component and never upgrade it. You might fall behind on security concerns and be running different code from your counterparts but you can do that if you like. If you consume some service, you're going to have to keep your app up-to-date should the service chage, go away, or fail. Therefore one could argue that services are easier to manage centrally at the expense of some overhead and less flexibi…

That doesn't sound like a primary difference between the two? You can certainly leave up an old service.

Yes, but that is not up to the consumer of the service (or not under the direct control of the consumer, in any case; assuming for the sake of argument that the consumer of the service is distinct from the producer)

Re: Microservices - 72 resources

#35
post #6

Why do we need a new term for this? Isn't this just Unix philosophy applied to SaaS? No need to learn about "micro services" when you can learn about Unix/Linux and why it's built the way it is, then apply that knowledge to your SaaS product.

Reminds me about when the web finally realized that grids and ratios, common principles that print-related specialists have known and used for decades.

At least that case kept the same names, I think.

Re: Microservices - 72 resources

#36
post #22

Earlier quoted context omitted.

Transactions spanning several microservices violate their autonomy - one service should not lock resources of another. Jeppe Cramon explains it pretty well in http://www.tigerteam.dk/2014/micro-services-its-not-only-the...

That's often not practical. Say you're a shop front. If you have a goods purchase service and a goods delivery service, you want to reserve the good (limited quantity) and reserve a time slot for transport (limited number of deliveries a day) before you charge the customer, and make the "commit". And if you'd merge two separate companies into one uber-service, you've just created more problems than you've solved.

[deleted]

Re: Microservices - 72 resources

#37
post #22

Earlier quoted context omitted.

Transactions spanning several microservices violate their autonomy - one service should not lock resources of another. Jeppe Cramon explains it pretty well in http://www.tigerteam.dk/2014/micro-services-its-not-only-the...

That's often not practical. Say you're a shop front. If you have a goods purchase service and a goods delivery service, you want to reserve the good (limited quantity) and reserve a time slot for transport (limited number of deliveries a day) before you charge the customer, and make the "commit". And if you'd merge two separate companies into one uber-service, you've just created more problems than you've solved.

Atomic transactions are one of several strategies for handling this problem, and not always the right answer.

Starbucks is a good analogy (http://www.eaipatterns.com/ramblings/18_starbucks.html). If Starbucks were transactional, you would have to stand there at with the money on the counter and wait until your drink was finished, then exchange at the exact same time. Even the mental image is ridiculous.

In practice, it makes much more sense to allow the system to enter certain inconsistent states and then remediate them. Out of an ingredient? Refund the money. Can't pay? Pull the drink out of the queue, or just write it off. This can involve some cost, but less cost than than the throughput you'd lose by enforcing consistency.

For your specific example of a goods delivery service, most take-out restaurants fly in the face of these claims: you can pay the driver in cash when they arrive. They are willing to accept the risk that you made your order fraudulently, won't pay, etc. because it's still better for them to have your business.

If you reserved a time-slot or inventory for someone whose credit card is declined, so what? Just un-reserve it. It's not hard to UPDATE a row in a database. The system was in an inconsistent state for 10 seconds. Big whoop. (You might have turned down a legitimate customer, but only if they were consuming the last resource, and if demand is that high, another customer will buy the item.)

Notice that Ticketmater and most airlines will hold your seats (i.e. leave the system in an inconsistent state) for up to 15 minutes while you enter your card details. Hell, Ticketmaster can easily reverse a transaction at any point up until the moment your ticket is scanned at the door. So could an airline, and they often do.

The classic example of account balances isn't necessarily the case either - banks can INSERT records of individual transactions. Since addition is commutative, race conditions are irrelevant. Balances are then calculated nightly offline by playing back the transaction records. I guess that's a form of locking, but even if it weren't, the balance isn't the source of truth - the transactions are, and the balance can be recomputed.

Banks also don't hide the complexities of transaction processing. Your "current balance" is different from your "available balance" and your most recent transactions show as pending anyway.

You don't need transactions as often as you think you do.

Re: Microservices - 72 resources

#38
post #32
post #23

Earlier quoted context omitted.

Request/Reply pattern makes a poor choice for communication between services - it increases coupling. It doesn't matter much if it comes with HTTP or any other flavour. Again, Jeppe nails it in very detailed post: http://www.tigerteam.dk/2014/microservices-its-not-only-the-...

I feel somewhat petty for this complaint as the content is good, but I found that link almost unreadable. It felt like someone awkwardly shouting random words in sentence, having every other word wrapped in . If anyone else finds this, here's a quick thing to paste into the developer console to make it more readable (the content is worth it): var jq = document.createElement('script'); jq.src = "http://ajax.googleapis…

Just wanted to say I completely agree. The extremely heavy bolding is very distracting.

Re: Microservices - 72 resources

#39
post #12

Are people typically building their microservices infrastructure on top of a SQL database, or other datastores? I'd be concerned not just about the overhead of managing lots of different (though simple) services, but also the fact that you give up a lot of convenient & useful features that you could get for free with a monolithic application, such as transactions. You either have to avoid needing transactions between…

You have to design around such constraints.

You can emulate transactions to a certain extent by marking things are "incomplete" (which may result in things being invisible in some contexts) until they can be marked as complete across all services — an operation which cannot be atomic, but which can be "atomic enough" – or aborted. Versioning may be an option.

Sometimes you need "all or nothing" state management in a single microservice: You want to do "POST /object" multiple times and then cancel all of them on failure, for example. In one app we have a data import process which populates a microservice with a complex data model with many 1:n and n:m relationships. Instead of doing multiple REST calls (POST and so on), we build a "batch" object, which is essentially a JSON document. This batch lives in the microservice and acts like a persistent transaction. When we want to apply the changes, we tell the service to commit the batch. If the batch cannot be applied because it conflicts — ie., changes have been made by someone else since the batch started — the entire batch is dropped and the import starts from scratch. It's not terribly elegant or efficient, but it's fairly simple.

Re: Microservices - 72 resources

#40
Breaking down an application into micro services allows me to keep a clearer picture of the entire application and how it should work. Not to mention the advantage of evolving the services individually without affecting the entire system.

I've started a little library in Python for writing small services. It leverages nanomsg. link: https://github.com/walkr/nanoservice

Post reply on HN