Software Engineer
Great Software Laboratory (GSLab)PHP developer
Earth Solution Private LimitedJira
.png)
Jenkins
I have more than 7 years of experience in PHP Laravel, as well as Python, MySQL, and JavaScript.
Well, in one of our table locations, it has a huge data, like 50 to 60,000 rows. So we have to optimize it. So for that, we have written a stored procedure and done indexing on the columns. And while fetching the data, we have used group by and many other options. So that has improved the speed of the data. Also, from a performance point of view, we have used lazy loading.
Well, I will use transactions, DB transactions. So, in case if anything fails, I will roll back the transaction. If anything goes well, I will commit the transaction. This will ensure data integrity.
Will you connect with the front-end developers about what they want, what data they want? So, accordingly, you would then structure that data in the same way. And also, you need to understand how large that dataset is, whether you have to send all the data at once or you can send the data in chunks.
So for that, we can use this caching Redis cache so far. So if there's data and I'm using API to fetch it, what I can do is I can use a cache. I can cache the data so that will improve the speed. So for example, if new data is inserted in the same table, I will clear the cache, and that will help in updating the data as well.
I have not implemented it, but other singularities, like, other solid principles like dependency inversion. I have used that, but not this list of solution principle.
Well, what you can do is create a middleware as an abstraction layer and in that, you will have the header. So that way, that header will apply to all the rest APIs. Instead of writing here, it's better to create a different class and then use that class to implement it. That way, we can use that middleware on or that class anywhere in the application.
Well, in here, we have to use a parameterized video. Like, instead of directly writing this query, this is prone to MySQL injection. So instead, we should use a parameterized query and also sanitize the data first, like, we have to remove the tags, specifically script tags.
We had use cases already in the table. It was a one to one relationship at first, but then the data got too big, so we had to change the relationship. The data that was already in the table, we created a new table and used a one to many relationship in that.
So for that, you need to have the first thing. You need to define exceptions. So in case if anything fails, the users should know. We can have events. So in case if a failure happens, and if a cron job is running, it's better to implement Apache Airflow. That is more resilient.
So firstly, what you can do is cache all the static files. Okay. And then, we have to cache all the views and routes as well. That way the application will be faster. And also, in the views, we have to load the CSS file first and then load the JS after the page loads.
It completely depends upon the use cases. Like, if I have a query, whether that will give me the result with ORM or that will give me the result with raw SQL. So it all depends upon the speed, how much time will it consume, and how simpler I will write. Do I have all the options with Laravel or not?