What is the purpose of peer-review in journals? I am interested in what is the role of peer review in journals. I have read the wikipedia page which discuss much about style and criticism but few to purpose. I don't know if initially it already came with comments to improve articles (more in favor of peer review for increase the quality of articles) or where simple recommendations to editors to not printing an article (in favor of filtering articles).

I am curious because my first contact with peer review history is the anecdote of an Einstein article beeing peer reviewed and Einstein refusing the review around 1905. 

There were three main factors of adopting peer review as listed on a post:


The increasing specialization of science
The enormous increase in the number of scientific papers being published 
There are technologies for copying papers


It seems that increasing the number of journals (and having less/no general journals) could have solved those problems. (which may indeed happened)

However it is unclear to me the purpose of the peer review. Is peer review (or/and was) used to increase quality of articles published in journals? Or "simply" to filter out articles to keep few (and more important) articles per issue of the more specialized journals?
Of course peer review might be doing both effects and having both purposes.
It's a method to inform journal editors about the soundness of any arguments, their originality, and the correctness of any data used in the submitted work. This enables them to keep a good standard of published work (and helps the authors to improve their manuscript to achieve the required standard).

Thus, it serves as a quality control mechanism. Without it, editors would have to review on their own (which is still some form of peer-review, though not anonymized). This was standard in Einstein's days, but is completely impractical today for three reasons.


The sheer amount of submitted manuscript has grown substantially.
The scientific community is much more diverse with less overlap of personal areas of expertise, such that no single editor can judge more than a fraction of the manuscript they receive.
Allowing reviewers to stay anonymous avoids biases and provides a fairer process.


So, the editors' expertise must now be to find expert reviewers and to interpret their reviews appropriately (rather than being experts themselves as 100 years ago).

Admittedly, the mechanism does not work 100%, i.e. sometimes good work is rejected and sometimes poor work is accepted (depending also on the community and journal), but their appears to be no viable alternative.