This paper is focused on performance optimization of applications based on non-relational databases. Firstly there will be explained differences between relational and non-relational databases and also compared the types of non-relational databases. Then the advantages and disadvantages between MongoDB and ElasticSearch (SQL) database systems will be described and compared. After both database systems were implemented on the web server, their speed is compared in order to determine which system is better to use in different conditions and tasks.